CGI's - an introduction

Normally HTML pages are static files that are prepared by their authors, and retrieving the page always yields the same information. The WWW would be extremely limited and boring if this was the limit of its functionality. Luckily it is not, it is possible to produce pages that are dynamically created; their content being different every time, maybe depending upon input from the client or from some external source.

Such pages are created by CGI scripts. These are programs written by the organisation producing the web server content, normally in scripting languages such as Perl or sh, or compiled languages such as C.

CGI scripts can be used to process input data submitted from a HTML form and produce an appropriate response in return. Such an example might be an online shopping system whereby customers enter their credit-card details, the items they wish to purchase and their address. The CGI scripts might then go and validate the data submitted by the client, connect to some back-end database system to check whether such products are in stock, and if so to allocate them to the customer and send a dispatch order to the sales department. Another CGI might then produce a HTML page as a response to the client confirming the success of the order, the amount that was debited off their credit-card and the expected delivery date.

They are not just restricted to form input however. CGI scripts can be used in any part of the page makeup, in fact their use is only limited by your imagination (and time!).

The requirements for a CGI script are pretty simple, and in the following sections we provide from simple examples to help guide you through the process of creating your own.


Back to CGI index