Forms, part II: Getting the data

As promised, here is the second of a two-part series on Web forms and CCN. This time we'll figure out how to get information from the different items of your form (described in last month's article) to you, as a CCN user or IP.

The MAILTO action

A new Lynx browser for CCN is in beta-testing, and may become standard-issue by the time that you read this. If not, you can become part of the testing group by subscribing to the beta-lynx mailing list. (The preceding link will subscribe you, but you must be logged on to your CCN account, not browsing from another Internet provider.)

The MAILTO action tells the user's Web browser, be it Netscape, Mosaic, Lynx, or most other browsers, that the form results should be emailed, instead of sending them to a CGI script. CGI scripts are those quiet, behind-the-scenes programs that process WWW forms or add interaction to Web homepages. On CCN, you are limited to the array of pre-made CGI scripts both on CCN's server and elsewhere -- in other words, making a custom CGI program to process a custom Web form of your own design is mostly out of the question. This is where the MAILTO action comes in. In your Web page's HTML, start off your form with this:

<FORM METHOD="POST" ACTION="mailto:zz999@ccn·cs·dal·ca">
(where zz999@ccn·cs·dal·ca should be replaced with your email address)

After the happy Web surfer has completed your custom form and clicks the "Submit" button, the Web browser will automatically mail the results off to zz999@ccn·cs·dal·ca. You'll find the results in your email INBOX. They won't look pretty -- in fact, they'll be almost impossible to read as the responses will be "escaped", changing ?, +, ", :, //, and other characters to sequences starting with a percent sign until the whole thing looks like something that I wrote -- but they'll be there.

There is at least one freeware program somewhere "out there" that will "unescape" the responses and place them one-per-line, but it requires you to download the mailing to your PC or Mac and that's just too inconvenient.

There are a few, hard-to-find generic CGI scripts kicking around that will mail the results to you nicely formatted, but I doubt that they would appreciate a few thousand non-customers unknowingly using their network resources to mail form results direct-to-you.

The best way to learn how to design a form is by example. If you [go people] and search for "form", you will be presented with a long list of people with the text "form" or "<form ..." in their Profile.html. This leaves out all of the mentions of "guestbook" or perhaps homepages with different filenames from Profile.html, but it's good enough for a start. Many people use mf2, the generic mail form briefly described in September's article. Others use pm2, the back-end to mf2. Both of these forms are very limited, and for most cases I would recommend using a MAILTO form instead, but for a simple "Guestbook" design they're ideal.

Figure One: Form escape sequences
Figure Two: Example MAILTO form

Next month

Next month I'll have some links (ugh!) for Power Users to lessen the February Blahs[TM].


Chebucto Connections TIPS FOR POWER USERS
is edited by Michael Smith
who is happy to receive Questions, Comments or Suggestions.
If your browser does not support mail, write to Michael later at aa529@ccn·cs·dal·ca.

Last Month: December 1995 Next Month: February 1996