|In this tutorial we will discuss a special type of HTML form tag called the hidden input tag.|
As you have already learned, when your website visitor enters information into the web form and clicks the Submit button, the user's information is passed along to a processing program. But suppose you want to pass other information to the processing program that is not supplied by the user. You will do this with the hidden input tag.
Let's take a look at an example. At most commercial websites a customer can enter his personal account area by clicking on one of several links. He may click on the My Account link. But if he is not signed in already, he will first be taken to the Sign In form. Or perhaps he clicked on the Wish List link. Again, if he is not signed in, he would still be sent to the same Sign In form. Once the customer signs in, he is then redirected to the webpage that he originally requested. In order to redirect your customer to the correct webpage, you will need to tell the processing program what webpage the person originally requested. You will use the hidden input tag to pass this information to the processing program along with the username and password supplied by the customer. Then if the username and password are correct, the program will use the "hidden" information to redirect the customer to the correct webpage.
I should point out that the hidden input tag isn't really "hidden" at all. It is very visible when anyone clicks View > Source (Internet Explorer) or View > Page Source (NetscapeR) and reads the HTML code for your webpage. So you will not want to use the hidden input tag to pass information that needs to be secure such as credit card numbers. The term hidden comes from the fact that this tag tells the web browser NOT to put anything in the webpage form but to pass the information invisibly to the program.
In the next article, we will take a look at the HTML code for this type of input tag.