How To Create HTML Documents
(Hypertext Markup Language)

Continued

Page 5


Forms



The following elements are used to create forms:

<form> ... </form> - A form within a document
<input> ... </input> - One input field
<option> - One option within a Select element.
<select> ... <select> - A selection from a finite set of options
<textarea> ... </textarea> - A multi-line input field

Each variable field is defined by an INPUT, TEXTAREA, or OPTION element and must have a NAME attribute to identify its value in the data returned when the form is submitted.

Example of use: (This is similar to your guestbook form)

<FORM METHOD="POST" ACTION="http://www.powerup.com.au/cgi-bin/mailgate"> <input type=hidden name="recipient" value="jsmith@powerup.com.au"> <input type=hidden name="redirect" value="http://www.powerup.com.au/~jsmith/guestbook/guest.htm">

Name <BR><INPUT NAME="Name" TYPE="text" SIZE="30"><BR>
E-Mail <BR><INPUT NAME="email" TYPE="text" SIZE="30" <<BR>
URL (if you have one) <BR><INPUT NAME="url" TYPE="text" SIZE="30" VALUE="http://"><BR>
Your City, State or Country <BR><INPUT NAME="hometown" TYPE="text" SIZE="30"><BR>
Your Age: <br><SELECT NAME="age">

<OPTION SELECTED>Choose One...
<OPTION>10 - 15
<OPTION>15 - 20
<OPTION>20 - 25
<OPTION>25 - 30
<OPTION>30 - 35
<OPTION>35 - 40
<OPTION>40 - 45
<OPTION>45 - 50
<OPTION>50 - 55
<OPTION>55 - 60
<OPTION>60 - 65
<OPTION>65 - 70
<OPTION>70 - 75
<OPTION>75 - 80
</SELECT>
<BR>
Gender: <BR>
<SELECT NAME="gender">
<OPTION SELECTED>Choose One...
<OPTION>Male
<OPTION>Female
</SELECT>
<BR>
<BR>
Comments:
<BR>
<TEXTAREA NAME="comments" ROWS="7" COLS="50" wrap=virtual></TEXTAREA><BR>
<BR>
<INPUT NAME="name" TYPE="submit" VALUE="Send Form">
<INPUT NAME="name" TYPE="reset" VALUE="Wipe It Clean">
</FORM>


It will appear like this:

Name

E-Mail

URL (if you have one)

Your City, State or Country

Your Age:

Gender:


Comments:





Next       Return to Main page