June 2005
Beginner
480 pages
10h 31m
English
When a CGI program is run as the result of a form submission, the field names and values passed in from the form—called parameters—need to be processed by the CGI program. This is done with the param function.
Without any arguments, the param function returns the names of the fields being passed into the CGI program. If the CGI program was accepting the form in Listing 22.1, the param function would return body, sex, name, and submit.
With an argument, param returns the value of that parameter. For example, param('sex') would return the value of the radio buttons—either male or female—depending on which was selected.
Listing 22.2 contains a short CGI program to print these parameters.
Read now
Unlock full access