Each option has its own value attribute. They will
generally differ from each other.
The list items are given by the contents of the option tags.
For the selected list item, the name from the select is
sent with the value from the selected option.
Using savedat.php. It will saves whatever data your
form sends into a file.
Save your form in a directory local_html/forms. Won't work
unless you put your form there.
Create a directory formdat under your home directory (not
under local_html).
Change permissions so the web server can write your data directory.
[test@sandbox test]$ cd local_html [test@sandbox local_html]$ mkdir forms [test@sandbox local_html]$ cd .. [test@sandbox test]$ mkdir formdat [test@sandbox test]$ chmod a+w formdat
Forms located in local_html/forms may use an action URL
http://sandbox.mc.edu/savedat.php
The data file name is created based on the page name: a page stored
as local_html/forms/mike.html will have
its data stored in formdat/mike_data.txt under the same
user account.
If you create an ordinary page at
local_html/forms/mike_resp.html, it will be displayed
after the data is successfully stored.
In case of an error, or if you don't create a resp file,
savedat.php will
generate its own response page.
Validation.
User may decide to send junk.
Javascript may be used to refuse to send the junk.
Since there's nothing to force the client to use Javascript,
the server program that processes the data will need to check again,
just to be safe.
Deliberately sending illegal data to a web form is a favorite hacker
trick, since some kinds of bugs may allow unauthorized access.
Server-side processing program.
The action URL of form refers to a program which
processes form data.
Many possible languages; depends on type of server and administrative
configuration.
Book's example is ASP, a Microsoft language.
Here is a similar script in PHP which
runs on Sandbox..
A word about https and secure transmission.
Ordinarily, data from a form can be snooped by anyone who has
access to the lines or networking equipment it transits.
Secure web sites use encryption to prevent this.
URLs that start with https use the encrypted version of the
protocol.
The URL of the form action is most important. It is
possible to create a form that always shows https in the
stripe, but sends data by plain http.
The https protocol also requires that a certificate authority
vouches for the identity of the web site.
CA's are just companies that your browser manufacturer trusts.
Examples: Thawte, Verisign, Entrust
etc.
Web sites present a certificate which is electronically signed by
the authority indicating that the authority believes
the web site is really what the URL says.