HTML
Example
An HTML form with two input fields and a submit button:
<form action="demo_form.php" method="get">
First name:
<input type="text" name="fname">
<br>
Last name:
<input type="text" name="lname">
<br>
<input type="submit" value="Submit" form>
Try it »
(More examples are at the bottom of the page)
Browser support

All major browsers support the tag.
Tag Definition and Usage Notes
The tag is used to create an HTML form for user input. The element contains one or more of the following form elements:
Differences Between HTML 4.01 and HTML5
HTML5 adds two new attributes: autocomplete and novalidate, and no longer supports some attributes from HTML 4.01.
Differences between HTML and XHTML
In XHTML, the name attribute is deprecated. Use the global id attribute instead.
property
New : New attributes in HTML5.
| property |
Value |
Description |
| accept |
MIME_type |
Not supported in HTML5. Specifies the type of file the server receives. (Files are submitted through file upload.) |
| accept-charset |
character_set |
Specifies the character set of form data that the server can handle. |
| action |
URL |
Specifies where to send the form data when the form is submitted. |
| autocompleteNew |
on |
|
| off |
Specifies whether the form's autocomplete feature is enabled. |
|
| enctype |
application/x-www-form-urlencoded |
|
multipart/form-data
text/plain | Specifies在向服务器发送表单数据之前如何对其进行编码。(适用于 method="post" 的情况) |
| method | get
post | Specifies the HTTP method used to send the form data. | | name | text | Specifies the name of the form. | | novalidateNew | novalidate | If this attribute is used, the form is not validated when submitted. | | target | _blank
_self
_parent
_top | Specifies where to open the action URL.
Global Attributes
The tag supports [HTML Global Attributes](/tags/ref-standardattributes.html).
Event attribute
The tag supports [HTML Event Attributes](/tags/ref-eventattributes.html).
Try it - Example
A form with checkboxes
This form contains two checkboxes and a submit button.
A form with radio buttons
This form contains two radio buttons and a submit button.
Related Articles
HTML Tutorial:HTML forms and input
HTML DOM Reference Manual: Form Object