Chapter 2. Usage

Table of Contents
How it works [an overview]
Invocation
Standard Input
Standard Output
Environment Variables
URL-Encoding
Form-Data Format

How it works [an overview]

CGI programs are usually started and execute in response to a user pressing the "submit" button on a HTML form. The web browser packages up the form data and sends it back to the web server, which then executes the CGI program and passes the form data along to it.

The CGI script then processes the information and sends the data which it wants to return to the user, finishing when done. The web server passes the information back to the web browser, and the user sees the information. If the response the CGI program sends is another HTML form, then the cycle can begin again. All is dependent on what the CGI program does and outputs to the user.