Chapter 6


What You Will Learn in This Chapter

  • How to create a form
  • How to use different types of form controls
  • What happens to the data a user enters
  • How to make forms accessible
  • How to structure the content of forms Code Downloads for this Chapter

The code downloads for this chapter are found at on the Download Code tab. The code is in the Chapter 6 download and individually named according to the names throughout the chapter.

Almost every time you want to collect information from a visitor to your site, you need to use a form. Some forms are quite complex, such as those that enable you to book plane tickets or purchase insurance online. Others are quite simple, such as the search box on the homepage of Google.

Many online forms bear a strong resemblance to paper forms. On paper, forms are made up of areas to enter text, boxes to check, options to choose from, and so on. Similarly, on the web you can create a form by combining form controls, such as textboxes (to enter text into), check boxes (to place a cross 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 to collect all kinds of information from visitors to your site.

NOTE HTML is used only to present the form to the user; it does not enable you to say what happens with that data after it is collected. To get a better ...

Get Beginning HTML and CSS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.