Prev Up Next
Go backward to 4.4 CGI Introduction to Perl Topic #2
Go up to 4 Major Topics
Go forward to 4.6 Cookies

4.5 Form Processing

This topic is to introduce HTML forms. This is where the WWW gets a bit more interesting. The client can finally provide some real data to the server.

The data from the user can be information about the user, information about something wanted, or purchase information. The possibilities are endless.

There are two primary ways for the CGI program to get the data, "POST" & "GET". POST sends the input through the the standard input to the CGI program while GET uses the environment variable "QUERY_STRING". You can determine the type of request by looking at the environment variable "REQUEST_METHOD".

The details in handling the the character translations and different form methods needs little attention. Use someone else's code to do it. Look at the file common.pl for some ideas, or just use it. You may want to revise your last lab so that it can handle forms using ether method.

4.5.1 Preparation

  1. Read Chapter 4 of CGI Programming by Gundavaram On the web at O'Reilly. Pages 51-85.
  2. Create a form, and point it at your environment program. Look at the environment created by the HTTPD as provided to your program when presented with a form.
  3. If you choose, modify the program to look at the standard input STDIN if the request method is "POST".

4.5.2 Individual Task

If you have a project in mind with about the same complexity using forms please talk to me before starting this one. It never hurts to do something that is actually useful to someone.

4.5.3 Report

Turn in your report marked as follows:
Instructor: ltaber@pima.edu** My new Home on phRed** The Pima College Site** The Mad Dr. G.'s home page on phred.

Prev Up Next