The <form> Tag

The <form> tag is used to place a form on a Web page and to indicate that the fields within it are all part of the same form.

Form fields can’t be placed on a page at all unless they’re enclosed within a <form> tag.

To create a form, the following syntax is used:

<form> 
<!--  insert form fields here --> 
</form> 

There are a number of attributes associated with the <form> tag that control the behavior of the form. Each of the attributes has a default value, so they can all be left out, as I did in the previous example. I’ll go through the attributes associated with the <form> tag one by one.

In this chapter, you’ll see that I use ...

Get Sams Teach Yourself CGI in 24 Hours, Second Edition 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.