- Attribute of
- Input As The Fundamental Form Element In HTML: Here's What It Does
- What does
- Specifies the name of an input element. The name and value of each input element are included in the HTTP request when the form is submitted.
<form> <label for="name" id="name">Name</label><br/> <input name="name" id="name"> </form>
Never omit the
name attribute is probably the most important attribute of the
<input> element. It isn't strictly required for validation, but you should never omit it. When a form is submitted to the server, the data from the form is included in an HTTP request. The data is packaged as a series of name-value pairs. The name for each name-value pair is the
name attribute of each input, and the value is the user-entered (or pre-specified) value. Without the
name attribute, an
<input> element cannot provide its value to the server on form submission.