chapter five

Working with Forms

The World Wide Web is the single greatest tool ever invented for collecting information. Web forms are responsible for this. We use them every day, whether we are purchasing something online, doing research using our favorite search engine, or logging into our e-mail. Web forms have become an essential part of our everyday browsing experience; in fact, without them, the Internet would be a rather dull place (yes, really).

Joe’s website needs a web form so that customers can book a table directly through the website. This chapter teaches you how to create a simple web form and embed it within your web pages. First, you will create the new Bookings page with a barebones form. Once you have your page set up, you will start adding a number of different form fields to it using a range of HTML elements, such as <input>, <label>, <select>, and <textarea>. You will finish by updating the site navigation and sitemap to include the new Bookings page.

In this chapter you are just going to focus on creating a basic form using elements that were present in HTML4. Once you have this form set up, Chapters 6 and 7 will teach you how to use new HTML5 features to enhance your web forms. These new features include specialized input types that make it easier for users to input data and tools for validating the data inputted by users. Figure 5-1 shows the completed Bookings page that you will be building in these three chapters.

Figure 5-1 The completed Bookings page, ...

Get HTML5 Foundations 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.