ToC ~ Up ~ Prev ~ Next ~ Index Introduction to HTML
Last Update: 5 January 1998

9.4 Fill-out FORMS and Gateway Programs

FORMs were discussed in Section 4.13. To remind you, a typical, if somewhat idiotic form, looks like:

First entry field: <INPUT NAME="entry1"> <BR>
Second entry field: <INPUT NAME="entry2" VALUE="bloop"> <BR>
Third entry field: <INPUT NAME="entry3">  --- 
Select Option: <SELECT NAME="entry4">
<OPTION VALUE="no1">Frogs
<OPTION VALUE="no2">Peaches
<OPTION VALUE="no3">Cream
<OPTION VALUE="no4">Newts

To submit the query, press: <INPUT TYPE="submit" VALUE="Submit Query">. <P> </FORM>

Note that you can use TABLEs to format the layout of the form, and make it look a lot better than that shown above. The above FORM is rendered as follows:

First text entry field:
Second entry field:
Third entry field: --- Select Option:
To submit the query, press: .

9.2.1 Encoding of FORM Data

Now, how are these data sent to the server? In general, each form input element is assigned a variable name, such as entry1 through entry4 in the above example. The user input is known as the value assocaited with the names. When the data are sent to a server, they are often (but not always!) encoded as strings of the form:

  name1=value1&name2=value2 ....

where name1 .. are the names, and value1... are the values selected by the user. The = and & characters have special meanings in this encoding scheme, and indicate the separators between variabbles. This means that if there are any real = and & in the strings, these must be encoded to "hide" them. They are encoded via the URL encoding, namely as %xx, where xx is the hexadecimal code corresponding to the character.

This encoding, with MIME type application/x-www-form-urlencoded, gets rather messy in detail, and is discussed in the online FORM documentation at NCSA. It is also extensively discussed in my book (among others).

If you are going to do a lot of FORM design and CGI programming, I advise you to get a book that explains how FORMs and CGI programs work, as there are a lot of small details that you will need to know, and that are not described in this short introduction

ToC ~ Up ~ Prev ~ Next ~ Index Introduction to HTML
© 1994-1998 by Ian Graham
Last Update: 5 January 1998