Webmaster

HTML : Fill-In Forms
Contents ]
Jérôme Versavel

Definition

A form is a section of a Web document used to collect information from users. It consists of normal content and graphical elements called controls. Once visitors have input data, they can click on a button to submit the form. The data is then validated and handled by a server-side process.

Example of form definition:

  <FORM method=GET action="/cgi-bin/mailer">
[Input fields]
  </FORM>

As with many HTML elements, forms are delineated by generic tags: <FORM> and </FORM>. The other elements are then placed between these two tags.

The <FORM> tag is used with two main attributes:

  • ACTION, which specifies the URL of the script to be executed after data input and submission.

  • It can be a relative or an absolute URL.

  • METHOD$, which can take one of the two values GET or POST.

  • This attribute specifies how the data collected will be transmitted to the server. The method chosen depends on the script you use and the information to be sent.

You can use four types of controls to collect user data from a form:

  • Buttons (<BUTTON> tag.)

  • Single-line data fields, checkboxes and radio buttons (<INPUT> tag.)

  • Selection list (<SELECT> tag.)

  • Multi-line data fields (<TEXTAREA> tag.)

All these tags are used with a NAME attribute which helps to identify the user data once received by the server.

They also have a TYPE attribute to distinguish between the various control types.



1   2   3   4   5   6 
Buttons