MFL 195 - Integrating Technology

As you saw in the examples we looked at last week in Web-Based Activities for Foreign Languages, interactive forms are very useful. In the exercise below, we will create a simple survey using a form.
There are basically five types of form entries you can put on a web page: a text box (in which the individual types in a one-line response), a text area box, which allows for longer written responses, a radio button (for multiple choice questions for which only one answer is correct), check boxes (for questions to which there may be more than one answer possible), and drop boxes from which the reader chooses the response from a list of preselected entries. Our survey will include one of each so you can see how they are done.
To begin, go into Notepad and start a new web page in the usual way:
|
<html> <head> <title>Student Survey</title> </head> <body> <center><h1>Student Survey</h1></center> |
|
<FORM METHOD="post" ACTION="http://www.furman.edu/cgi-bin/FormMail.pl"><br> <input type=hidden name="recipient" value="firstname.lastname@furman.edu"><br>
<input type=hidden name="sort" value="order:name,language,countries,wish,comments"><br> <p> |
The first line of this command did three things:
In lines two through four of the code above, all begin with input
type=hidden. Normally, the command INPUT will imply
some action on the reader's part (type in a box, check a box,
etc.), but in this case the action is going on behind the scenes
and will be taken care of by the cgi script. In line two, you
are announcing that you want the form sent to your e-mail address.
In line three, you are telling the computer that when the results
are returned to you, the heading you want on the page is Survey.
The last line tells the computer in what order to report the
data to you. Our form will contain a text box for the person's name
(hence, "name"), a series of radio buttons for choosing the
individual's native language (hence, the "name" of this item
is "language"), a series of check boxes for the reader to indicate
what countries he or she has already visited (check boxes, since
there may well be more than one possible answer; and the name
we're going to give to this item is "countries"), a drop box from
which the student may choose the one country she would most
like to visit (hence, the name "wish"), and finally a text
area for the student to add any comments (name = "comments"). When
the data comes back to you in your e-mail message, it will
look like this:
Here's what produced the box above:
|
1. What is your name? <INPUT TYPE="text" name="name" SIZE=30> <p> |
SIZE indicates the length of the text box. You can make it any length you want by increasing or decreasing this number.
OK, here's the code you need for your form:
|
2. What is your native language?<br> <INPUT TYPE="radio" NAME="language" VALUE="English">English<br> <INPUT TYPE="radio" NAME="language" VALUE="French">French<br> <INPUT TYPE="radio" NAME="language" VALUE="Spanish">Spanish<br> <INPUT TYPE="radio" NAME="language" VALUE="Other">Other<br> <p> |
If you accidentally check a box you don't mean to check, you can simply click on it again to make the X disappear.
Here's the source code you'll need for this question:
| 3. What countries have you already visited?<br> <input type="checkbox" name="countries" value="England">England<br> <input type="checkbox" name="countries" value="France">France<br> <input type="checkbox" name="countries" value="Spain">Spain<br> <input type="checkbox" name="countries" value="Mexico">Mexico<br> <input type="checkbox" name="countries" value="Senegal">Senegal<br> <input type="checkbox" name="countries" value="Canada">Canada<br> <input type="checkbox" name="countries" value="None of the above>None of the above<br> <p> |
First, an example. Let's say I wanted to find out at what level you teach. I might give you a drop box. To open it, click on the small down arrow in the gray box on the right. Then highlight and click on the appropriate box.
Ok, here's the source code for our drop box:
|
4. What is the one country you would really like to visit?<br> <SELECT NAME="wish" SIZE="1"> <OPTION SELECTED>France <OPTION>Germany <OPTION>Spain <OPTION>Mexico <OPTION>Senegal <OPTION>Canada </SELECT> <p> |
The source code for our text area box looks like this:
|
5. Comments: <br> <TEXTAREA NAME="comments" ROWS=4 COLS=50></TEXTAREA> <p> |
The source code for these buttons is a snap:
|
<INPUT TYPE="submit" VALUE="Send"><INPUT TYPE="reset" value="Start Over"> <p> |
|
</FORM> </BODY> </HTML> |
If you want to see what your form should look like when it is completed, click here.
Patricia L. Pecoy
MFL 195
This page was last updated on July 12, 1997