By Nik Silver
CGI is the Common Gateway Interface which allows you to create Web pages on the fly based on information from buttons, checkboxes, text input and so on. The pages can be images, sounds, text and indeed everything else transferable by the Web. They can even be references to other Web pages. In this tutorial we concentrate on creating HTML documents (rather than images and sounds) but the principles transfer readily to other formats. This should provide a good start to cope with the more comprehensive documentation elsewhere. For example, you should be able to find your way around the CGI programmer's reference with greater purpose, and perhaps some of the CGI material on Yahoo.
What CGI scripts are
Normally when a Web browser looks up a URL the following happens. First your computer contacts the HTTP server with the URL. The HTTP server looks at the filename requested by your computer and then sends that file back. Your computer then displays the file in the appropriate format.
However, it is possible to set up the HTTP server so that whenever a file in a certain directory is requested that file is not sent back; instead it is executed as a program, and whatever that program outputs is sent back for your computer to display. This function is called the Common Gateway Interface or CGI. The programs are called CGI scripts. The directory that the CGI scripts sit in cannot be specified by you alone - you need the help of whoever runs your HTTP server.