Adding CGI Scripts

A CGI script works by taking input from your Web page and sending that input to an external program for processing. Usually, it returns a new Web page that has the results of that processing on it. The input is most often data from a form, but it can sometimes be just a link that a user clicks to activate the program.

Basic techniques

Before you do anything, you have to get the script. Whenever I describe a script in this book, I provide you with the URL of the site from which you can download the script. After you have the script, follow these basic steps to use it:

1.
Read the instructions for the script. Let me say that again: Read the instructions. After you’ve worked with a few scripts, it’s tempting to just plunge right ahead without looking. After all, most scripts plug in pretty much the same way, and you can often get away with skipping the instructions. That’s the cause of about 812 percent of the problems that people have with scripts, though. All it takes is to misunderstand or misinterpret one little setting, and the whole script won’t work. The instructions are often in the standard ReadMe.txt file. Sometimes, the script doesn’t have a ReadMe file, though, and the instructions are embedded in the text of the script itself in the form of comments. (Comments are notes the programmer adds to provide information, and they’re marked so that they’re differentiated from the program code and don’t interfere with the running of the program.)
2.
Open the ...

Get Building a Web Site For Dummies®, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.