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 that allow 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 THIRD EDITION 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.