'type' equal to 'hidden' means that particular form input will not show up to the user but all details of this input will be passed to the server when this form is submitted.
value is whatever you want to be passed to the server for that particular input. value could 'hello' or '1' or '1999A' etc etc
When do we use this? suppose I have 2 forms, form1 and form2. How do we decide which form was submitted?. For this, we'll use a input type as hidden, name as 'form_type' and value as 'form1' when we submit the first form, and value as 'form2' when we submit the second form. In this way, we know which form are we dealing with. e.g.
- Code: Select all
<input type="hidden" name="form_type" value="form1" />