How HTML Forms Work
Long ago (Internet time),
in 1997, I was introduced to HTML.
Wonderful stuff could be done with it, things like changing background colors
and font sizes and automatically generated borders and table widths dynamically
sized in relation to the width of the browser window, and on and on. All
these neat things could be done simply by putting markup tags into the web
page source code.
It was magic.
Then, I tried making a form. And the magic went poof.
I had spent a lot of time on that form. It had every form element that my
handy HTML reference guide listed. There were checkboxes, radio buttons,
a few text input fields, and even a textarea field.
But when I filled in the form and clicked the submit button, nothing
I thought maybe I used a tag wrong, so I went over the entire form, tag by
Everything was correct. Yet, clicking did nothing.
So I took my source code to a fellow I admired because he knew HTML better
than anyone. He said -- and this was to be one of my real lessons about forms
-- "what did you tell the form it was supposed to do with the information?"
It was a forehead-slapping moment, an "of course!" realization such as a
person experiences once in a while in the process of living life.
I learned the rule:
"If you don't tell the form what to do with the information, it will do nothing
The form can do one of two things with the information (other than ignoring
it, of course):
1. Have the browser process it, or
2. Have the browser send the information somewhere else for processing.
Ways the browser can process the information --
The browser needs more than only HTML and links to process form
or some other programming language that can be incorporated into the source
code of the web page.
numbers, and re-printed on the web page. The re-printing can be an automatic
update of form fields or printing the information elsewhere on the web page,
possibly in a DIV layer.
It is the programming language's abilities that determine what is possible
for the browser to do with the form information it is processing.
Sending the information somewhere else for processing --
The browser can send the information to one of two places:
1. To an emailing program on the user's computer.
2. To a CGI or other program on a server somewhere on the Internet.
When sent to an emailing program on the user's computer, all of the form
information is sent for inclusion in the email. It would usually have an
email address for the information to be sent to and probably a subject line.
How well this works depends on the capabilities of the user's emailing program
and, indeed, whether or not the user's browser can launch the email program
in the first place.
When sent to a CGI program on your server, what can be done with the information
is limited only by the program it is sent to. It can be sliced, diced, merged,
blended, calculated, stored in databases, printed as web pages, and sent
A web page form is used to collect information from users. The form works
by submitting the information either to the browser itself or to a program
somewhere else. What happens after that is not under the form's control.
It's fairly simple, when one thinks about it. All forms really do is collect
information and send it somewhere.
Forms have to be told what information to collect (the form fields) and they
have to be told what to do with the information.
If you would like to learn how to build forms (which is actually telling
the form what information to collect) and how to tell a form what to do with
the information once collected, see the two-part "HTML Form Tutorial" linked
By the time you finish the tutorial, having actually tried everything presented
there, you may well be perceived as a "form guru" by your friends.
About the Author:
Copyright 2003 Bontrager Connection, LLC
Bontrager Programmer/Publisher, "WillMaster Possibilities"
Are you looking for top quality scripts? Visit
and check out his highly acclaimed Master Series scripts. Some free, some
for a fee.