|
If
a Form has only one text entry field, a submit
button is not required, simply pressing the enter
key will submit the form to the Program identified
in the beginning Form tag. However, if there are
more fields, a Submit Button is required. The
following example shows the addition of a Submit
and Reset button.
|
<form
METHOD=POST ACTION="http://www.enetrics.com/cgi-bin/formmail.cgi">
<input TYPE="text"
NAME="persons-name" SIZE="40"
MAXLENGTH="40">
<input TYPE="hidden"
NAME="recipient" SIZE="40"
MAXLENGTH="40">
<input TYPE="password"
NAME="password" SIZE="10"
MAXLENGTH="10">
<input TYPE="submit"
NAME="Request" VALUE="Submit
This Form">
<input TYPE="reset"
NAME="Clear" VALUE="Clear
Form and Start Over">
</form>
|
The Submit and Reset buttons are also coded with
the input tag. The TYPE parameter identifies the
field to be a button.
The
value of "submit" tells the browser,
when the button is pressed, send the form to the
Web server for processing by the CGI program.
The
value of "reset" tells the browser,
when the button is pressed, reset the form to
the default values. The default values can be
either blank, or in some situations identifying
a box to be checked, or a radio button to be selected.
The VALUE parameter identifies the text that will
appear on the button.
At
this point, we have a full blown Form with 2 text
entry fields. One for Name, and one for the password.
Remember, the third field, "recipient"
is a hidden field. To see what this tag would
look like, press here.
Of
course the Form isn't formatted very well. This
brings me to the next point. You can embed other
HTML tags inside the Form itself. The following
is the modified Form code to make it formatted
a little bit more like a form should be:
|
<p
ALIGN=Center>
<center>
<h1>Example of Form with 2 Text
fields</h1>
</center>
</p>
<form METHOD=POST ACTION="http://www.enetrics.com/cgi-bin/formmail.cgi">
<p>Person's
Name:
<input TYPE="text" NAME="persons-name"
SIZE="40" MAXLENGTH="40">
<input TYPE="hidden" NAME="recipient"
SIZE="40" MAXLENGTH="40">
</p>
<p>Password:
<input TYPE="password" NAME="password"
SIZE="10" MAXLENGTH="10">
</p>
<p>
<input TYPE="submit" NAME="Request"
VALUE="Submit This Form">
<input TYPE="reset" NAME="Clear"
VALUE="Clear Form and Start Over">
</p>
</form>
|
Click here to see the modified form!
Beginning/Ending
Form Tags
Text
Entry Fields
Text
Area Fields
Checkboxes
Radio
Buttons
Combo
Boxes
Submit
and Reset Buttons
E-Mail
the Contents of your Form
Example
Forms
|