<li>In <a href="../html/doctype.html#strict">HTMLá4.0 Strict</a>, one or more <a href="../special/script.html">SCRIPT</a> or <a href="../block.html">block-level elements</a> except FORM</li>
<p>The <strong class=html>FORM</strong> element defines an <em>interactive form</em>. The element should contain form controls--<strong class=html><a href="input.html">INPUT</a></strong>, <strong class=html><a href="select.html">SELECT</a></strong>, <strong class=html><a href="textarea.html">TEXTAREA</a></strong>, and <strong class=html><a href="button.html">BUTTON</a></strong>--through which the user interacts.</p>
<p>When the user submits the form, through an <strong class=html>INPUT</strong> or <strong class=html>BUTTON</strong> element with <strong class=html>TYPE=submit</strong>, the form values are submitted to the <abbr class=initialism title="Uniform Resource Identifier">URI</abbr> given in <strong class=html>FORM</strong>'s required <strong class=html>ACTION</strong> attribute. <strong class=html>ACTION</strong> usually points to a <abbr class=initialism title="Common Gateway Interface">CGI</abbr> script or Java servlet that handles the form submission.</p>
<div class=note>
<p>A mailto <abbr class=initialism title="Uniform Resource Identifier">URI</abbr> (<abbr title="for example"><i lang=la>e.g.</i></abbr>, <strong class=html>mailto:liam@htmlhelp.com</strong>) is also allowed as an <strong class=html>ACTION</strong>, but this is not supported by all browsers. Non-supporting browsers such as Microsoft Internet Explorerá3.<var>x</var> typically will open a blank e-mail message when the user submits a mailto form. Even on supporting browsers, mailto forms are troublesome in that they fail to provide feedback to the user after the form submission.</p>
<p><a href="http://www.cgi-resources.com/Programs_and_Scripts/">Free <abbr class=initialism title="Common Gateway Interface">CGI</abbr> scripts</a> exist for handling forms; some are even <a href="http://www.cgi-resources.com/Programs_and_Scripts/Remotely_Hosted/Form_Processing/">remotely hosted</a> for authors whose providers refuse to allow <abbr class=initialism title="Common Gateway Interface">CGI</abbr> scripts to be run locally.</p>
</div>
<p>How the form input is sent to the server depends on the <strong class=html>METHOD</strong> and <strong class=html>ENCTYPE</strong> attributes. When the <strong class=html>METHOD</strong> is <strong class=html>get</strong> (the default), the form input is submitted as an <abbr class=initialism title="HyperText Transfer Protocol">HTTP</abbr> GET request with <strong class=html>?<var>form_data</var></strong> appended to the <abbr class=initialism title="Uniform Resource Identifier">URI</abbr> specified in the <strong class=html>ACTION</strong> attribute.</p>
<p>Using the <strong class=html>get</strong> method allows the form submission to be contained completely in a <abbr class=initialism title="Uniform Resource Locator">URL</abbr>. This can be advantageous in that it permits bookmarking in current browsers, but it also prevents form data from containing non-<acronym title="American Standard Code for Information Interchange">ASCII</acronym> characters such as "Θ" and "⌐". As well, the amount of form data that can be handled by the <strong class=html>get</strong> method is limited by the maximum length of the <abbr class=initialism title="Uniform Resource Locator">URL</abbr> that the server and browser can process. To be safe, any form whose input might contain non-<acronym title="American Standard Code for Information Interchange">ASCII</acronym> characters or more than 100 characters should use <strong class=html>METHOD=post</strong>.</p>
<p>With a <strong class=html>METHOD</strong> value of <strong class=html>post</strong>, the form input is submitted as an <abbr class=initialism title="HyperText Transfer Protocol">HTTP</abbr> POST request with the form data sent in the body of the request. Most current browsers are unable to bookmark POST requests, but POST does not entail the character encoding and length restrictions imposed by GET.</p>
<p>The <strong class=html>ENCTYPE</strong> attribute specifies the content type used in submitting the form, and defaults to <strong class=html>application/x-www-form-urlencoded</strong>. This content type results in name/value pairs sent to the server as <var>name1</var>=<var>value1</var>&<var>name2</var>=<var>value2...</var> with space characters replaced by "+" and reserved characters (like "#") replaced by "%<var>HH</var>" where <var>HH</var> is the <acronym title="American Standard Code for Information Interchange">ASCII</acronym> code of the character in hexadecimal. Line breaks are encoded as "%0D%0A"--a carriage return followed by a line feed.</p>
<p>Authors should generally only use a different <strong class=html>ENCTYPE</strong> when the form includes a <strong class=html>TYPE=file</strong> <strong class=html><a href="input.html">INPUT</a></strong> element, in which case the <strong class=html>ENCTYPE</strong> should be <strong class=html>multipart/form-data</strong> and the <strong class=html>METHOD</strong> must be <strong class=html>post</strong>. The format of multipart/form-data requests is given in <cite><a href="http://ds.internic.net/rfc/rfc1867.txt" title="Form-based File Upload in HTML"><abbr class=initialism title="Request for Comments">RFC</abbr> 1867</a></cite>.</p>
<p class=note>Tools such as <a href="http://www.htmlhelp.com/tools/cg-eye/">cg-eye</a> allow authors to easily create and view a request, simulating the submission of a form. However, authors often do not need to concern themselves with the exact format of the submission; <abbr class=initialism title="Common Gateway Interface">CGI</abbr> libraries including <a href="http://www-genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html" title="CGI.pm - a Perl5 CGI Library">CGI.pm</a> transparently handle <strong class=html>get</strong> and <strong class=html>post</strong> submissions sent as application/x-www-form-urlencoded or multipart/form-data.</p>
<p>The <strong class=html>ACCEPT-CHARSET</strong> attribute specifies a list of character encodings that are accepted by the form handler. The value consists of a list of "charsets" separated by commas and/or spaces. The default value is <strong class=html>UNKNOWN</strong> and is usually considered to be the character encoding used to transmit the document containing the <strong class=html>FORM</strong>.</p>
<div class=transitional>
<p>The <strong class=html>TARGET</strong> attribute is used with <a href="../frames/index.html">frames</a> to specify in which frame the form response should be rendered. If no frame with such a name exists, the response is rendered in a new window unless overridden by the user. Special frame names begin with an underscore:</p>
<ul>
<li><strong class=html>_blank</strong> renders the response in a new, unnamed window</li>
<li><strong class=html>_self</strong> renders the response in the current frame (useful for overriding a <strong class=html><a href="../head/base.html">BASE</a> TARGET</strong>)</li>
<li><strong class=html>_parent</strong> renders the response in the immediate <strong class=html><a href="../frames/frameset.html">FRAMESET</a></strong> parent</li>
<li><strong class=html>_top</strong> renders the response in the full, unframed window</li>
</ul>
</div>
<p>The <strong class=html>FORM</strong> element also takes a number of attributes to specify client-side scripting actions for various events. In addition to the <a href="../attrs.html#events">core events</a> common to most elements, <strong class=html>INPUT</strong> accepts the following event attributes:</p>
<ul>
<li><strong class=html>ONSUBMIT</strong>, when the form is submitted;</li>
<li><strong class=html>ONRESET</strong>, when the form is reset.</li>
</ul>
<h2>More Information</h2>
<ul>
<li><a href="http://www.w3.org/TR/REC-html40/interact/forms.html#edef-FORM">FORM in <abbr class=initialism title="World Wide Web Consortium">W3C</abbr> HTMLá4.0 Recommendation</a></li>
<li><a href="http://www.w3.org/TR/REC-html32#form">FORM in <abbr class=initialism title="World Wide Web Consortium">W3C</abbr> HTMLá3.2 Recommendation</a></li>
<li><a href="http://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.1.1">FORM in HTMLá2.0 Standard</a></li>
<li><a href="http://www.htmlhelp.com/reference/wilbur/block/form.html">FORM in <abbr class=initialism title="Web Design Group">WDG</abbr> HTMLá3.2 Reference</a></li>
<li><a href="http://www.hut.fi/u/jkorpela/HTML3.2/5.25.html">FORM in <cite>Learning HTMLá3.2 by Examples</cite></a></li>
<li><a href="http://ds.internic.net/rfc/rfc1867.txt"><abbr class=initialism title="Request for Comments">RFC</abbr> 1867: Form-based File Upload in HTML</a></li>
<li><a href="http://hoohoo.ncsa.uiuc.edu/cgi/">The Common Gateway Interface</a></li>