Note: This page is boring. You won't like it. We didn't like writing it, either.

On the previous page, we mentioned something called a "cgi script." That's the second piece of the puzzle that makes a cgi email form work.

You may have noticed this fairly worrisome looking line in the form's HTML:

<FORM ACTION="http://www.willa.com/cgi-bin/cgiemail/phobic.txt" METHOD="POST" ENCTYPE="application/x-www-form-urlencoded">

The FORM ACTION tells the browser what action is to be taken when someone fills in the email address field and presses the submit button. In this case, for the three people fascinated to understand thw whys and wherefors, the action to be taken is that the cgi email program, which is stored in the cgi-bin directory at the host server, causes whatever is typed into the address field to be plugged into a text file called "phobic.txt" and sent back to you in an email message. It's very important to note however that the specific ways that the cgi email program works, and the location of the program and the text file, are things that have to be clarified by your server administrator, because there are many different ways to accomplish the same goal--the goal of allowing you to collect information from a form. As an alternative method to achieve the same result, some hosts will provide you with thier standard form ,which you can cannibalise for your own particular purposes.

phobic.txt is a very simple text file that which sets up the format for the information (in this case, an email address) to be mailed to you. The "phobic.txt" file might look something like this:

To: phobic@technophobe.com
Subject: Mailing List
[email]

That's it.

It specifies the email address that the form information will be sent to (yours, or in this case, ours), tells what the subject line should be so that you will know immediately that you have a message from a mailing list subscriber, and it gives the name of the field ("email") to tell the program where to insert the information that the visitor input.

Whew. That was awful, wasn't it? [certainly was, Ed] Let's go on to something a little more thrilling [oh good]


Click to continue