O'Reilly logo

Sams Teach Yourself CGI in 24 Hours, Second Edition by Rafe Colburn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

An Example of Form Processing

Now let’s look at an example that demonstrates exactly how form processing works. This example consists of a simple application that displays a form, accepts the submitted form, validates the content, and displays the information (with or without an error message) back to the user.

The script itself is organized in components. The script begins with a pointer to the Perl executable. It follows by importing the CGI.pm module and creating a new query object to import the form parameters into the Perl namespace:

#!C:/perl/bin/perl.exe 

use CGI; 
$query = new CGI; 
					

The Main Script Logic

The body of the script contains the logic that determines whether to display the form for the first time, display the form with an ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required