The <FORM> Tag is a fill-out input form that allows the
data to be handled in many ways, typically a
CGI script. I'll explain this one myself
since the RFC specs are even over my head. A form is most often used as a
mailto Guestbook, although there are many different things you're able to
do with the data. For this example, I'll use part of my old
Feedback Form
and explain along the way.
Remember, this is just the elements of the <FORM> Tag, it
isn't a "How To Add a Guestbook" or CGI Tutorial.
The ACTION command is a URL of the script that handles the submitted data.
The script, among other things, E-Mails me the information you submitted,
stripping the unnecessary code so it's in a readable format.
In a Form, the ACTION acts as a "what" and the METHOD acts as a
"how". The METHOD command can be POST (to put) or GET (to gather).
It's very difficult to understand without knowing how CGI interfaces with
form input, but 99% of the times you use the METHOD="POST" when
you're sending data into a script.
Next is part of INPUT, hidden fields, which is a field than can't be edited
by the person who's filling the form out. These are script-specific and
most of the time contains data that doesn't change. Also check out the
<INPUT> Tag for a more in-depth
explanation.
The TYPE=HIDDEN is passed along to the form ACTION, without being visible
on the form itself. The NAME command is what the script uses as a "what
to do with it". Hidden fields are different depending on what CGI
script you're using, so this example may only show you an example, and no
real significance beyond that.
Enter Your Name:
<input type="text"
size="33"
maxlength="256"
name="name">
The TEXT is used for a single line text fields. This is used with SIZE,
the visible width in characters, MAXLENGTH, the allowed width in characters
of the field, and NAME, the identifier the script uses.
Enter Your Home Page Address:
<input type="text"
size="33"
maxlength="256"
name="url"
value="http://">
This is the same as the "Enter Your Name" example,
but with a value command, which sets the initial value for that input field.
The <OPTION> command is a pull-down list of choices.
The SELECT NAME command is part of the form which tells it what is reported
to the script.
<select name="Heard_About_From">
<option value="newsgroup">Newsgroup</option>
<option value="personal_bookmark">
A Bookmark on a Personal Page</option>
<option value="com_bookmark">
A Bookmark on a CommercialPage</option>
</select>
Here is another effect you can do by specifying a larger SIZE.
<select name="Heard_About_From" size="3">
<option value="newsgroup">Newsgroup</option>
<option value="personal_bookmark">A Bookmark on a Personal Page</option>
<option value="com_bookmark">A Bookmark on a Commercial Page</option>
</select>
There are other common commands which I didn't use on this
particular form, such as:
At the end of a form, There should be a SUBMIT Button, and an
optional RESET button, followed by the closing </FORM>
Tag.
<input type="submit" name="Submit"
value="Submit this here form">
<input type="reset" name="Reset"
value="Reset this here form">
</form>
Feel free to put your Form inside a
<TABLE> for
better design. Also check out the
<INPUT> Tag for a more in-depth
explanation . These are just the basics of the <FORM>
Tag, it's up to you to decide
what to do with it (the CGI magic part of it).