Tell a friend about this site

Home Page

Next Page

Previous Page

Contents Page


Download tutorial in Zip form







When your first web page is up on the World Wide Web, why not apply for our Good Start Award?

TaFWeb Good Start Award

Using Your Form

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>
<INPUT TYPE=HIDDEN name="recipient"VALUE="username@isp.com">Please enter the subject of your mail: <BR>
<INPUT TYPE=TEXT NAME="subject"><BR>
Please enter your email address: <BR>
<INPUT TYPE=TEXT NAME="email"><BR>
Please enter the content of your email: <BR>
<TEXTAREA NAME="content" ROWS=9 COLS=45></TEXTAREA><BR>
<INPUT TYPE=SUBMIT></FORM>

The form looks like this:

Please enter the subject of your mail:

Please enter your email address:

Please enter the content of your email:


(Don't try this form - it won't work!)

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.:



Try out the form now

Your name:

Your email address: (e.g.: you@aol.com)

Gender:  

Do you have a "Home Page" on the Internet?
Yes
No

Home Page URL:

Please indicate which of the following browsers you use:
Netscape Navigator (or Communicator)
Internet Explorer
Other browser

FreeForm
FREE feedback form powered by FreeForm
 
FreeForm

Decoding Your Form Response

If you're using a service such as the FreeForm one above you will face one other slight problem - decoding the form response when it arrives. Below is an example of such a form response:

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.


rule


Top of Page


This page hosted by
Planet Tripod
Get your own
Free Home Page

 

These pages are copyright © Terry Franks June 2003.
Terry Franks
Last major revision: 20 January 1999 at 02:34 BST
Minor revisions: 22 October 2002 at 03:15 BST
This document URL: https://members.tripod.com/~terry_franks/webintro13.html
TerryFranks is
a member of

The HTML Writers Guild