The INPUT element defines an input field. When you specify "hidden" for the type attribute of this element, a hidden input field is created.
<input type="hidden" name="example" value="hidden value">
| Attribute | Value | Explanation |
|---|---|---|
| type=" " | hidden | the type of input field |
| name=" " | field name | a unique name for the field |
| value=" " | initial value | this value is submitted |
This field is not displayed in the browser. (However, it is possible to see in the source code.)
type="hidden"
Creates a hidden input field on the form.
name=""
The field name is used to identify the form field.
value=""
This value is submitted to the server.
<form method="POST" action="example.cgi">
<p>Hidden field
<input type="hidden" name="subject" value="Contact Form"></p>
<p>Name<br>
<input type="text" name="Name" size="40"></p>
<p>Comments<br>
<textarea cols="50" rows="5" name="Comment"></textarea></p>
<p><input type="submit" value="Submit"></p>
</form>
This form cannot submit because of a sample.