Creating HTML Forms

To create a form in HTML, you use the <FORM> tag. As with many HTML tags, you need to place a beginning tag at the start of the form and a closing tag at the end of the form, in this case <FORM> and </FORM> respectively. More than one form can be in a single document, but forms cannot be nested.

Forms can contain single- and multiple-line entry fields, check boxes, radio buttons, list boxes, push buttons, and hidden data. Every form has a Submit button that users can press to have their data sent to the Web server for processing. This data is a list of NAME/VALUE pairs, one for each component of the form. The NAME and, optionally, the initial VALUE of each form component is specified in the HTML code. Then the user can fill out the form and modify the VALUEs.

Here is an example of an HTML form:

<FORM METHOD="POST" ACTION="/cgi-bin/name.acu">
Please enter your name or leave the entry field 
blank for "anonymous": 
  <INPUT TYPE="text" NAME="username" SIZE=60>
  <INPUT TYPE="submit" VALUE="Submit">

The FORM tag has two attributes that must be defined: