HTML Form Tag
The <form> tag creates an interactive form for collecting user input. It's the container that holds all form controls and defines how the form data is submitted.
Form Container
The <form> element wraps form controls (inputs, selects, textareas, buttons) and defines the submission behavior. All form controls must be inside a form to be submitted together.
Action and Method Attributes
The action attribute specifies the URL where the form data is sent when submitted. The method attribute defines how the data is sent: get (data in URL) or post (data in request body).
Form Submission
When a submit button is clicked, the browser collects all form control values (those with name attributes) and sends them to the action URL using the specified method. The page may reload or navigate to the response.
Best Practices
Always give form controls name attributes so their values are included in submission. Use post for sensitive data or large amounts of data, and get for search forms or bookmarkable URLs. Consider using <fieldset> to group related fields.
