FORM - HTML forms
Appearance: <FORM ACTION=
, METHOD=get|post, ENCTYPE=
H1, H2, H3, H4, H5, H6, P, UL, OL, DIR, MENU, PRE, DL, DIV, CENTER, BLOCKQUOTE, HR,
TABLE, ADDRESS, as well as TT, I, B, U, STRIKE, BIG, SMALL, SUB, SUP, EM, STRONG,
DFN, CODE, SAMP, KBD, VAR, CITE, A, APPLET, IMG, FONT, BASEFONT, BR, MAP, INPUT,
SELECT, TEXTAREA and plain text.
May occur in: : BODY, DIV, CENTER, BLOCKQUOTE, TH, TD and DD, LI.
Forms allow a person to send data to the WWW server. You can use the INPUT, TEXTAREA and SELECT tags
to add individual elements, such as checkboxes, input fields or "drop down" lists to your form. A form may
contain all markup (both text and body level tags), but it may not have a nested form.
FORM has one required attribute, ACTION, specifying the URL of a CGI script which processes the form and
sends back feedback. There are two methods to send form data to a server. GET, the default, will send the form
input in an URL, whereas POST sends it in the body of the submission. The latter method means you can send
larger amounts of data, and that the URL of the form results doesn't show the encoded form.
You can specify an encoding type with ENCTYPE, the default of "application/x-www-form-urlencoded" is most
widely supported. An alternative is "text/plain", which is typically used in combination when the ACTION attribute
points to a mailto: URL. If a browser supports both, the contents of the form is sent in plain text to the indicated
A form should always have at least one submit button. This can be done with <INPUT TYPE=submit
NAME=submitit> or with an image: <INPUT TYPE=image NAME=submitit>.
More than one submit button is legal. If each submit button has a unique NAME attribute, the name of
the selected submit button is sent along with the rest of the form input. This allows the parsing script to
determine which button was pressed.
The URL specified in the ACTION attribute does not have to be a CGI script, although you can get pretty
weird results if you try to feed data to a document which isn't a CGI script. A popular reason to do this is
to get a "button" which when pressed takes you to a new page. This can be done with: