HTML name attribute
name attribute specifies a unique name for the html elements. name attribute is very important because it is used to retrieve the data of form.
<form action="files/name.php" method="post">
<p>Username:<input type="text" name="fname"></p>
<p>Password:<input type="password" name="password"></p>
<p><input type="submit" name="sign" value="sign in"></p>
</form>
</>
Attribute values
All possible values of name attributeThe value of name attribute is plain text.
Related Tags
The tags that support name attribute<input> tag
-
input tag represents an input field. name attribute specifies a unique name for the input control that is used to process the data. In the other words, this attribute is used in the back-end.
<output> tag
-
The following example represents the product of two numbers in input field.
-
<form oninput="op.value = x.valueAsNumber * y.valueAsNumber"> <input name=x type=number >* <input name=y type=number >= <output name=op for="x y"></output> </form>
Try</> <select> tag
-
The data of select element is manipulated by the name attribute.
-
<form action="files/selectname.php" method="post"> <select name="scountry"> <option> United States <option> Japan <option> United Kingdom <option> Quait <option> Egypt </select> <input type="submit" name="country" value="Enter"> </form>
Try</> <textarea> tag
-
textarea tag represents multi line resizeable textarea.
-
<form action="files/textareaname.php" method="post"> <p>Email: <input type="email" name="email"></p> <p>Comment:<textarea name="comment" cols="100" rows="100"> </textarea></p> <input type="submit" name="send">
Try</> <iframe> tag
-
Here name attribute is used to browse the content in iframe element.
-
<a href="http://www.codingb.com" target="open">Learn HTML</a> <iframe name="open" width="400px" height="400px"> </iframe>
Try</> <map> tag
-
The name attribute connects the image to the map element.
-
<img src="files/three images.jpg" usemap="#shapes" alt="one shape of triangle"> <map name="shapes"> <area coords="13,122,50,61,86,123" href="files/triangle.html" shape="poly"> </map>
Try</> <meta> tag
-
name represents keywords, description, author and application name.
-
<head> <meta name="keywords" value="unique comma separated keywords"> <meta name="description" value="A brief description about the page"> </head>
Next Previous
Was this article helpful?