O'Reilly logo

Beginning Web Programming with HTML, XHTML, and CSS, Second Edition by Jon Duckett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Forms

Almost every time you want to collect information from a visitor to your site, you need to use a form. You have probably used several different kinds of forms on different web sites, from simple search boxes, which allow you to enter keywords in order to find what you are looking for, to complex forms that allow you to order groceries or book a holiday online.

Forms on the Web bear a strong resemblance to paper forms you have to fill out. On paper, there are areas to enter text, boxes to check (or tick), options to choose from, and so on. On the Web, you can create a form by combining what are known as form controls, such as text boxes (to enter text into), checkboxes (to place a tick in), select boxes and radio buttons (to choose from different options), and so on. In this chapter you learn how each of these different types of controls can be combined into a form.

In this chapter, then, you learn:

  • How to create a form using the <form> element

  • The different types of form control you can use to make a form—such as text input boxes, radio buttons, select boxes, and submit buttons

  • What happens to the data a user enters

  • How to make your forms accessible

  • How to structure the content of your forms

By the end of the chapter you will be able to create all kinds of forms to collect information from visitors to your site.

What you do with the data that you collect depends upon the server your web site is hosted on. XHTML is used only to present the form to the user; it does not allow ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required