HTML <form> Tag
Description:
The <form> tag is used to create an HTML form for user input.
A form can contain input elements like text fields, checkboxes, radio-buttons, submit buttons and more. A forms can also contain select menus, textarea, fieldset, legend, and label elements.
Specific Attributes:
| Attribute | Definition |
| action | Specifies a URI/URL of the page that will process the form. |
| method | Specifies the HTTP method to use when the form
is submitted. Possible values:
|
| enctype | Specifies the content type used to encode the
form data set when it's submitted to the server. Possible values:
|
| accept-charset | Specifies a list of character encodings that the server accepts. The default value is "UNKNOWN". |
| accept | Specifies a comma-separated list of content types that the server accepts. |
| name | Assigns a name to the form. This is used when referencing the form with stylesheets or scripts. If there are multiple forms, the name of each form must be unique. |
Other Attributes:
| Attribute | Definition |
| dir |
Specifies the text direction for the content in
an element.
|
| class | Specifies a classname for an element. |
| id | Specifies a unique id for an element. |
| lang | Specifies a language code for the content in an element. |
| target | Specifies where to open the action URL.
|
| style | Specifies an inline style for an element. |
Example Code:
<form action="" method="post">
First name: <input type="text" name="first_name" /><br />
Last name: <input type="text" name="last_name" /><br />
<input type="submit" value="Submit" />
</form>