HTML and CSS Reference
6 Creating a Form
on a Web Page
The goal of the projects completed thus far has been to present information to Web site
visitors. In this chapter, you will learn how to get information from Web site visitors by
adding a form for user input.
Using a Web page form for user input reduces the potential for errors because
customers enter data or select options from a form included directly on the Web page.
A form has input fields to remind users to enter information and limits choices to valid
options to avoid incorrect data entry. Forms provide an easy way to collect needed
information from Web page visitors.
In this chapter, you will learn how to use HTML to create a form on a Web page.
The form will include several controls, including check boxes, a drop-down menu, radio
buttons, and text boxes. You will also learn to add Submit and Reset buttons that custom-
ers can use to submit the completed form or clear the information previously entered into
the form. Finally, you will learn to use the <ieldset> tag to group information on a form
in a user-friendly way with the <legend> tag, which is used to add labels to the groups
within the form.
Project — Creating Forms on a Web Page
Jin Chen is a music business entrepreneur and lead singer in Blu Wav Music. He and his
band play at parties and weddings on the weekends, he has several recordings that music
lovers can purchase, and he is a regular guest on a variety of radio shows. Jin wants to
get a better idea of what types of music people like to listen to. He also wants to know
what radio stations people listen to and where they buy their music. Jin has a Web site
that advertises his band and his music. On the Web site, he has a form that visitors can
print and fax to him. That effort has not been very successful. He has therefore spoken
to you about using a form on the Web to gather information.
The Blu Wav Music Web page form is provided in the Data Files for Students for
this chapter. In this project, you will enter HTML tags to modify the static Web page
form that the owner of Blu Wav Music, Jin Chen, originally created shown in Figure 6-1a
and from it, create a dynamic Web-based form, as shown in Figure 6-1b. This page
requests the same information as the static Web page, but is created with a Web-based
form that allows users to enter data, select options, and then submit the form to an