<input name="">
Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
- Attribute of
- How To Use Input To Create Form Fields In HTML: Easy Tutorial
- What does
<input name="">
do? - 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.
Code Example
<form>
<label for="name" id="name">Name</label><br/>
<input name="name" id="name">
</form>
Never omit the name
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.