Level: 2

The form element is used to delimit a data input form. There can be several forms in a single document, but the form element can't be nested.

The action attribute is a URL specifying the location to which the contents of the form is submitted to elicit a response. If the action is missing, the URL for the document itself is assumed. The way data is submitted varies with the access protocol of the URL, and with the values of the method and enctype attributes. In general:

This standard defines and requires support for the http access protocol only.

When action is an HTTP URL, the method must be an HTTP method as defined by the HTTP method specification in the IETF draft HTTP standard. The default method is get, although for many applications, the post method may be preferred. With the post method, the enctype attribute is a MIME type specifying the format of the posted data (by default application/x-www-form-urlencoded).

Under any protocol, the submitted contents of the form logically consist of name/value pairs. The names are usually equal to the name attributes of the various interactive elements in the form.

The names are not guaranteed to be unique keys, nor are the names of form elements required to be distinct. The values encode the user's input to the corresponding interactive elements. Elements capable of displaying a textual or numerical value return a name/value pair even when they receive no explicit user input.

Preceding Section: Forms and Input fields
Following Section: input
Parent Section: Forms and Input fields
Contents of HyperText Markup Language