248 Chapter 12 – Forms
Demystifying CGI
Web Design in a Nutshell, eMatter Edition
use. If there’s one already installed, it may save you some time in develop-
ment.
- Can you upload your own scripts to the server?Again, depending upon your
arrangement for web site-hosting, you may not be permitted to upload your
own scripts to the server, particularly if you are sharing a server with other
sites. - Do you have upload privileges to the cgi-bin directory?Assuming you can
upload your own scripts to the server, you will need to make sure that you
have write privileges to the directory where the scripts are stored (usually
called cgi-bin). Your administrator may need to set up an account for you that
gives you access to the directory and allows you to make your scripts read-
able and executable by other users. - On what kind of server is your site hosted? What server software is it running?
Scripts are usually written to perform on a particular platform and web server
software configuration. Before you spend time customizing a script, be sure
that it can be run on your server. - What is the exact pathname to the script (once installed)?You will need to
include this in theactionsetting in a
Using Available Scripts
Let’s take a look at the process for customizing a free script found on one of the
CGI script archives. The purpose of this tutorial is to give you an idea of what to
expect and to show that you don’t need specific programming skills to do it.
In the following example, we use the FormMail script (written by Matt Wright),
which takes the contents of a form and sends it to a specified user in a formatted
email message. Although the script in its entirety (about nine book pages worth) is
not shown here, you can easily download it from Matt’s Script Archive (http://
http://www.worldwidemart.com/scripts/).
- First, make all the necessary arrangements with your server administrator as
outlined in the previous section. You should have an understanding of how
your particular server and account handle CGI scripts before proceeding. - Download the script. Upon downloading, you are given the script as well as a
very complete ReadMe file that outlines step-by-step the process for using the
script. Read the documentation carefully. - Configure the script. You may need to make changes within the script itself to
customize it for your use. Following is a sample of the FormMail script. (Note