Jump to: navigation, search

HTML form hidden field

From w3cyberlearnings

Contents

HTML - Hidden Field

The hidden filed is similar to the text field. The different is the hidden field is not shown on the web page. It is useful for processing or passing data in the web server or within the web page. When the form submit, the values in the hidden fileds are also sent to the server. Hidden field must be placed within the form. Not outside the form.

HTML - Syntax Hidden Field

<input type="hidden" name="my_HIDDEN_NAME" value="VALUE"/>

Note

Hidden field can be used to store any type of information, however it is not recommended for storing user password and any sensitive information.

Example 1

  • There are three hidden fields in this example.
    • The hidden field name="without_me" is outside the form, so it will not be included when submit the form.
    • The hidden filed name="my_code" and name="page" are within the form. It will be included when submit the form.
<html>
<head>
<title>Hidden Field</title>
</head>
<body>
<!-- not include in the form -->
<input type="hidden" name="without_me" value="I not include"/>

<form>
<input type="hidden" name="my_code" value="39444"/>
<input type="hidden" name="page" value="3"/>

<p>Request Information</p>
<label for="firstname">First Name:</label>
<input type="text" id="firstname" name="firstname"/><br/>

<label for="lastname">Last Name:</label>
<input type="text" id="lastname" name="lastname"/><br/>

<label for="emailrequest">Login Email:</label>
<input type="text" id="emailrequest" name="emailrequest"/><br/>
<input type="submit" name="submitform" value="Submit Request"/>
<input type="reset" name="resetform" value="Reset"/><br/>
</form>
</body>
</html>

Output

Html form hiddenfield 1.png

Related Link


Navigation
Web
SQL
MISC
References