Hidden Fields

The easiest way to have Web forms "remember" information is to embed previous information in them by using hidden fields. Hidden fields are part of the HTML forms specification which allows fields and values to be part of an HTML form but not appear in the form when it's rendered visually. In HTML, they're written as follows:

<INPUT type="hidden" name="fullname" value="Pink Floyd">

If the preceding HTML were put into a form, a new name ("fullname") and value ("Pink Floyd") would be part of the form. If the form were submitted to a Perl CGI program, the param function would return a key and a value for the hidden field.

The Online Store

For an example of how to use hidden fields, consider an online store that uses a series of Web ...

Get Sams Teach Yourself Perl in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.