CGIForm - A Irie Pascal sample CGI program

This program is an example of how to process forms using Irie Pascal CGI programs. A full listing of this program is not given on this page (because it would be too long).

You can download the full source code for this program using the download links at the bottom of this page.

What does CGIForm do?

Form data received

If the program receives form data then it just displayed this form data along with a link back to itself.

Form data NOT received

If the program does not receive any form data then it displays a form to accept input from the user and send this form data back to itself.

How does CGIForm work?

The main body of the program is shown below (the rest of the program is too long to be shown):

	begin
	Initialize;
GetCGIData;
ProcessCGIData;
GenerateResponse;
Shutdown;
end.
Initialize

This procedure initializes the program.

GetCGIData

This procedure retrieves any form data passed to the program. The form data is stored in a global buffer.

ProcessCGIData

This procedure reads the form data in the global buffer (if any is there), and seperates the data into name/value pairs and stores them in a global list.

GenerateResponse

This procedure generates the response and writes it to the standard output stream. The exact response depends on whether any form data was passed to the program. If form data was passed to this program then the previous procedure would have placed it into the global list and this procedure will generates a response that displays the form data. If form data was not passed to this program then the global list will be empty and this procedure will generates a repsonse that contains a form to accept user input.

Shutdown

This procedure disposes of the global list.

Run CGIForm

CGIForm has been compiled and installed on this server. To see it run, click here.

Download CGIForm

Source code: cgiform.pas (size=11,347 bytes).

If you are using the Irie Pascal IDE (available only in the Windows edition) then you should also download the IDE project file: cgiform.ipj (size=1,762 bytes).

Put the source file and the project file in the same directory and open the project file.