| Attribute | Value | Description |
|---|---|---|
| accept-charset | character_set | Specifies the character encodings that are to be used for the form submission |
| action | URL | Specifies where to send the form-data when a form is submitted |
| autocomplete | on off | Specifies whether a form should have autocomplete on or off |
| enctype | application/x-www-form-urlencoded multipart/form-data text/plain | Specifies how the form-data should be encoded when submitting it to the server (only for method="post") |
| method | get post | Specifies the HTTP method to use when sending form-data |
| name | text | Specifies the name of a form |
| novalidate | novalidate | Specifies that the form should not be validated when submitted |
| rel | external help license next nofollow noopener noreferrer opener prev search | Specifies the relationship between a linked resource and the current document |
| target | _blank _self _parent _top | Specifies where to display the response that is received after submitting the form |
The accept-charset attribute specifies the character encodings that are to be used for the form submission.
<form action="/action_page.php" accept-charset="utf-8">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<input type="submit" value="Submit">
</form>
| Value | Description |
|---|---|
| character_set | A space-separated list of one or more character encodings that are to be used for the form submission.
Common values:
In theory, any character encoding can be used, but no browser understands all of them. The more widely a character encoding is used, the better the chance that a browser will understand it. To view all available character encodings, go to our Character sets reference. |
<form action="/action_page.php" method="get">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<input type="submit" value="Submit">
</form>
The action attribute specifies where to send the form-data when a form is submitted.
| Value | Description |
|---|---|
| URL | Where to send the form-data when the form is submitted.
Possible values:
|
<form action="/action_page.php" method="get" autocomplete="on">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="email">Email:</label>
<input type="text" id="email" name="email"><br><br>
<input type="submit">
</form>
The autocomplete attribute specifies whether a form should have autocomplete on or off.
When autocomplete is on, the browser automatically complete values based on values that the user has entered before.
Tip: It is possible to have autocomplete "on" for the form, and "off" for specific input fields, or vice versa.
| Value | Description |
|---|---|
| on | Default. The browser will automatically complete values based on values that the user has entered before |
| off | The user must enter a value into each field for every use. The browser does not automatically complete entries |
<form action="/action_page_binary.asp" method="post" enctype="multipart/form-data">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<input type="submit" value="Submit">
</form>
The enctype attribute specifies how the form-data should be encoded when submitting it to the server.
Note: The enctype attribute can be used only if method="post".
| Value | Description |
|---|---|
| application/x-www-form-urlencoded | Default. All characters are encoded before sent (spaces are converted to "+" symbols, and special characters are converted to ASCII HEX values) |
| multipart/form-data | This value is necessary if the user will upload a file through the form |
| text/plain | Sends data without any encoding at all. Not recommended |
s
<form action="/action_page.php" method="get">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<input type="submit" value="Submit">
</form>
The method attribute specifies how to send form-data (the form-data is sent to the page specified in the action attribute).
The form-data can be sent as URL variables (with method="get") or as HTTP post transaction (with method="post").
Notes on GET:
Notes on POST:
| Value | Description |
|---|---|
| get | Default. Appends the form-data to the URL in name/value pairs: URL?name=value&name=value |
| post |
Sends the form-data as an HTTP post transaction |
<form action="/action_page.php" method="get" name="myForm">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<input type="button" onclick="formSubmit()" value="Send form data!">
</form>
The name attribute specifies the name of a form.
The name attribute is used to reference elements in a JavaScript, or to reference form data after a form is submitted.
| Value | Description |
|---|---|
| text | Specifies the name of the form |
<form action="/action_page.php" novalidate>
<label for="email">Enter your email:</label>
<input type="email" id="email" name="email"><br><br>
<input type="submit">
</form>
The novalidate attribute is a boolean attribute.
When present, it specifies that the form-data (input) should not be validated when submitted.
The rel attribute specifies the relationship between the current document and the linked document.
| Value | Description |
|---|---|
| external | Specifies that the referenced document is not a part of the current site |
| help | Links to a help document |
| license | Links to copyright information for the document |
| next | The next document in a selection |
| nofollow | Links to an unendorsed document, like a paid link. ("nofollow" is used by Google, to specify that the Google search spider should not follow that link) |
| noopener | |
| noreferrer | Specifies that the browser should not send a HTTP referrer header if the user follows the hyperlink |
| opener | |
| prev | The previous document in a selection |
| search | Links to a search tool for the document |
<form action="/action_page.php" method="get" target="_blank">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<input type="submit" value="Submit">
</form>
The target attribute specifies a name or a keyword that indicates where to display the response that is received after submitting the form.
The target attribute defines a name of, or keyword for, a browsing context (e.g. tab, window, or inline frame).
| Value | Description |
|---|---|
| _blank | The response is displayed in a new window or tab |
| _self | The response is displayed in the same frame (this is default) |
| _parent | The response is displayed in the parent frame |
| _top | The response is displayed in the full body of the window |
| framename | The response is displayed in a named iframe |