[Homer 3D] Lesson 8 - a simple form

Forms are the way the web becomes truly interactive. They are how you can request something from a web server. The search engines mentioned in the last lesson are one example. Other forms are used to send e-mail to the web masters, request data, and almost anything else.

Forms provide input to computer programs (or scripts) that reside in the web server's cgi-bin. They are usually written in perl or c++.

Unfortunately, only web masters and other exulted wizards have access to the cgi-bin. However, you are in luck. I have written a perl script just for you!

For this lesson, you will be adding the following bold text (starting after the links section from lesson 7). As we go along, I'll explain what the statements mean.

<H3>A Simple Form</H3>
<FORM METHOD="POST" ACTION="http://mdsg.umd.edu/cgi-bin/echo.pl">

The URL listed in ACTION= specifies the script that this form uses.

Fill in the blanks below and press <B>Send </B> when finished or <B>Clear</B> to reset the fields.
<P>

You should aways explain what you'd like someone to do with your form.

Name: <INPUT TYPE="TEXT" SIZE=40 NAME="NAME">
<P>

This is an example of a text variable. A box that is 40 characters wide will be created. Any text entered into the box is stored in name, a variable used by the echo.pl script.

Where are you staying while in Chicago?
<INPUT TYPE="RADIO" NAME="FROM" VALUE="Hyatt">Hyatt Regency Chicago
<INPUT TYPE="RADIO" NAME="FROM" VALUE="Other hotel">Another Meeting Hotel
<INPUT TYPE="RADIO" NAME="FROM" VALUE="Duh">Don't know!
<P>

A radio type variable gives the person a choice of entries. Only one is allowed (whatever is selected is stored in from, another a variable used by the echo.pl script).

Why are you here? (select all that apply):<BR>
<INPUT TYPE="CHECKBOX" NAME="WHY1" VALUE="told"> Command performance
<INPUT TYPE="CHECKBOX" NAME="WHY2" VALUE="curious"> Want to learn HTML
<INPUT TYPE="CHECKBOX" NAME="WHY3" VALUE="surf"> Surf the web
<INPUT TYPE="CHECKBOX" NAME="WHY4" VALUE="duh"> D'oh <P>

Checkboxes also gives the person a choice of entries. Unlike radio, many items can be selected and stored in several variables (why1-why4), which are used by the echo.pl script.

<INPUT TYPE="SUBMIT" VALUE=" Send ">
<INPUT TYPE="RESET" VALUE=" Clear ">
<P>
<HR SIZE=5>

Finally, you provide to important buttons - submit sends the form to the web server and reset clears the entries.

<P>
Last modified on 26 April 1999
First posted on 29 July 1996
<P>
</BODY>
</HTML>


[Homer] View my page | Next lesson | Return to start

Last modified on 26 April 1999
First posted on 2 February 1996

Created by Dan Jacobs, Maryland Sea Grant