|
In the previous section we looked at the code needed to place a form on your web page. But the big question is how do you get to the data once the user has filled in the form? Strictly speaking, the best way is to use a CGI (Common Gateway Interface) script, probably written in a language such as Perl, contained in the cgi-bin folder of your server. However, unless you run your own server you probably don't have access to that folder -- most ISPs are very wary about letting strangers wander around cgi-bin!
To make up for this, most ISPs provide a few scripts which any subscriber can use, and many of them allow you to create your own form to use with the scripts. In this case, your ISP will be able to tell you how to get access to the script. It will probably mean putting something like this is your <FORM> tag:
<FORM ACTION="http://isp.com/cgi-bin/form.cgi" METHOD=POST>
Usually the script will take the data from the form and put it into an e-mail which will then be sent to you, so somewhere (probably in a Hidden element) you will have to include your e-mail address. Here is an example of a form provided by a service provider (it's been adapated so please don't try and use it, because it won't work!):
<FORM ACTION="/user-cgi/FormMail.pl" METHOD=GET>
The form looks like this:
If your ISP doesn't provide any scripts for you to use, all is still not lost. There are a number of places on the World Wide Web which will provide this service free of charge. One I've used myself is FreeForm (URL: http://www.note.com/success/public/freeform). The form below is one of theirs and it does work -- try it out and it will send your details to me.:
name=Terry+Franks&from=terry.franks@technologist.com& gender=male&have_homepage=Yes&homepage_url= http%3A%2F%2Fwww.hhdevel.com%2F%7Etafweb%2F
With a little bit of effort you can decode this into something more readable. Each part of the response is separated by a '&' symbol and consists of the control name, an equal sign and the response given in that control. For example, the control called 'from' is the one in which the user types his/her e-mail address. In the coded response this appears as '&from=terry.franks@technologist.com'. Throughout the encoded response spaces are replaced by '+' symbols. Any characters which are not normal letters or numbers are encoded as a hexadecimal code - the backslash ('\') for example appears as '%2F'.
If all this sounds a bit daunting you can make life a bit easier by downloading TaFWeb Software's Form Decoder which will do all the decoding for you and save the response as a normal, easy-to-read text file.
Now you've got your forms all sorted out, you are ready to go on to the last stage of the tutorial, Framing Your Site.
|
||||
|
Last major revision: 20 January 1999 at 02:34 BST Minor revisions: 22 October 2002 at 03:15 BST |
a member of |