An HTML form is a section of the page that groups interactive controls so visitors can enter information and submit it—contact messages, logins, searches, surveys, and uploads.
What does a form wrap?
Inside <form> you typically place inputs, textarea, select, label, optional fieldset/legend, and a submit control (<button type="submit"> or <input type="submit">).
Where does the data go?
action is the URL that receives the submission. method chooses GET (append to the URL) or POST (send in the request body). File uploads need enctype="multipart/form-data".
Forms hub vs form tag page
This tutorial focuses on building and submitting forms on an HTML page. Attribute-level detail for the element itself lives on HTML form Tag. Control types are covered on HTML Inputs.
name + label.
Every field you want submitted needs a name. Every visible control needs a real label.
Client checks are not enough.
required and pattern help users, but always validate again on the server.
One form, one job.
Do not nest forms. Keep each <form> focused on one submission flow.
HTML still defines action and method for real submissions.
preventDefault stops navigation in a JS demo.
FormData reads named fields after submit.
Try It opens the full editable contact page.
Edge Cases & Pitfalls
Most form bugs are missing names, wrong methods, or nested forms.
name
Controls without name
They look fine on screen but often never appear in the submitted data.
method
POST secrets with GET
Passwords and private data must not ride in the URL. Use POST (and HTTPS).
nest
Nested <form> elements
Invalid HTML. Keep one form per submission flow.
file
File upload without multipart
Set enctype="multipart/form-data" when sending files.
a11y
Missing labels
Placeholder-only fields are hard to use with assistive tech and after typing starts.
trust
Trusting browser validation alone
Users can bypass client checks. Validate again on the server.
Compatibility
Browser Support
The form element, GET/POST submission, labels, fieldset, and built-in validation are Baseline HTML. File uploads and constraint validation work in all modern browsers.
✓ Baseline · Widely available
HTML forms
Form containers and native submission work across current browsers worldwide.
100%form element
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
HTML formsUniversal
Bottom line: Wrap controls in form, set action/method, name every field, and label everything users must fill.
Remember
Key Takeaways
<form> groups controls for one submission.
action + method decide where and how data is sent.
One line: Wrap labeled, named controls in <form>, choose GET or POST, and submit to an action URL (or handle with script).
Frequently Asked Questions
A form is a section of a page that groups interactive controls—inputs, textareas, selects, and buttons—so users can enter data and submit it to a URL or handle it with script.
This tutorial teaches how to build and submit forms on an HTML page (action, method, labels, validation, fieldsets). The /html/tags/form page is the element reference for attributes and tag details.
Use GET for safe searches and filters (data appears in the URL). Use POST for creating or changing data, logins, and anything that should not sit in the address bar.
On submit, the browser sends name/value pairs. Without name, a control’s value is usually omitted from the submission.
required tells the browser not to submit until that field has a valid value. Combine it with type-specific checks such as email or pattern.
When the form includes a file input. That encoding lets the browser send file bytes with the rest of the fields.