HTML and CSS Reference
Every time you use a search engine, place an order, or join an online mailing list, you
use a form . A form is an XHTML element that contains and organizes objects called
form controls —such as text boxes, check boxes, and buttons—that can accept informa-
tion from Web site visitors.
For example, look at Yahoo!'s search form shown in Figure 9.1. You may have used
this many times but never thought about how it works. The form is quite simple; it con-
tains just two form controls: the text box that accepts the keywords used in the search,
and the search button that submits the form and gets the search started.
The search form on
Yahoo!'s home page
contains a box to
enter text and a
with permission of
Yahoo! Inc. ©2006
Yahoo! Inc. Yahoo!
and the Yahoo! logo
are trademarks of
Figure 9.2 shows a more detailed form, used to enter shipping information at irs.gov.
This form contains text boxes to accept information such as name and address. Select
lists (sometimes called drop-down boxes) are used to capture information with a limited
number of correct values, such as state and country information. When a visitor clicks
the continue button, the form information is submitted and the ordering process contin-
ues. Whether a form is used to search for Web pages or to order a publication, the form
alone cannot do all the processing. The form needs to invoke a program or script on the
server in order to search a database or record an order. There are usually two compo-
nents of a form:
1. The XHTML form itself, which is the Web page user interface
2. The server-side processing, which works with the form data and sends
e-mail, writes to a text file, updates a database, or performs some other type of
processing on the server