O'Reilly logo

Web Design in a Nutshell, 2nd Edition by Jennifer Niederst Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Demystifying CGI

Today, there are many options for processing forms on the server, such as ASP, PHP, and Java servlets. The traditional method is to use CGI scripts.

A CGI program (or script) can be written in a number of programming languages. It doesn’t matter to the server which you use, as long as it can retrieve data and send data back. On Unix, the most popular language is Perl, but C, C++, Tcl, and Python are also used. On Windows, programmers write scripts in Visual Basic, Perl, and C/C++. On the Mac, AppleScript and C/C++ are common.

Often designers assume that the cgi-bin directory contains things beyond our comprehension. It’s time to look behind the curtain! Although it is true that creating Perl and C scripts from scratch requires programming experience, you can still take advantage of the power of scripts by using one that is already made.

Many web-hosting services offer a library of standard CGI scripts that are already installed on their servers. In that case, all you may need to do is point to the script from your page. Some hosting providers also allow you to upload scripts of your own.

There are a number of great resources for CGI scripts on the Web, including scripts that process forms and send their contents in formatted email messages. Many of them are available for free and include exhaustive documentation that leads even a novice through the process of customizing and installing the script on the server. Some of the more popular CGI archives include:

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required