Hidden field in HTML
Hidden field is not displayed on the page and its content is hidden from the user. Visitor of the site can not insert or input anything into it. The purpose of creating the hidden field is to transfer technical information to the server. In most cases, it is used to send form data from page to page.
The syntax for creating a hidden field as follows.
<input type="hidden" name=... value=...>
- name - the name of the field, which allows the program to identify it.
- value - the value of the field determines what information will be sent to the server.
How to use a hidden field is shown in example 1.
Example 1. Creating a hidden field.
<form method="post" action="/cgi-bin/handler.cgi"> <b>Your favorite word (no data will be passed to the server!):</b><br> <input type="text" size="25"> <input type="hidden" name="UserName" value="Ronny"> <input type="hidden" name="password" value="pupkin"><br> <input type="submit"> </form>
The result is shown below.
In the example the hidden fields are not displayed on the web page, but when the form is sent to the server, hidden fields are passed along with it.