Chapter 4. Programming Paradigm

Table of Contents
Non-Interactive Processing
Segmented User Interaction
Multiple Simultaneous Invocations

Using the CGI requires that a specific paradigm be used for programming. There are three basic issues which affect the design of programs which use the CGI:

  1. CGI programs are non-interactive.

  2. Because of this, CGI programs require segmented user interaction.

  3. Multiple CGI processes may be running at the same time.

Non-Interactive Processing

The CGI Program doesn't continue to run while the user is interacting with the form data. There is no way for the CGI program to respond to a user's form changes in real time. Javascript can be used to handle some of this, but Javascript is not an elegant or ideal solution.

This, combined with the limitations of HTML forms, has created a rather standardized first step in almost every CGI program: error-checking of form fields. If the data in the form fields is inconsistent with what is required or the data is not present, then the CGI program will not be able to execute properly, and the user must be made aware that the form was submitted improperly. Therefore, a good first step for any CGI program is to perform error checking on all form fields received.