Version-//W3C//DTD XHTML 1.0 Transitional//EN
Elementform
Purposeinteractive form
DescriptionThis element is used to create a form to collect data from users. The data is collected through elements contained in the form. Once the user indicates that they are done with the form by clicking on a button, the data is sent to a Web server for processing by a common gateway interface (CGI) program. The results of this processing are then displayed to the user.

Creating forms for your Web site requires that you can prepare a common gateway interface (CGI) program to handle the form's processing and that you have permission from your system administrator to place this program in the a special directory, typically called cgi-bin, on your server, to hold CGI scripts.

Start tagRequired <form>
Attributes
NameTypeDefaultComment
accept CDATA #IMPLIEDcomma-separated list of media types as per RFC2045; list of MIME types for file upload
accept-charset CDATA #IMPLIEDa space-separated list of character encodings as per RFC2045; list of supported charsets
action CDATA #REQUIREDUniform Resource Identifier as per RFC2396; a Uniform Resource Locator (URL) is a URI; server-side form handler
class CDATA #IMPLIEDspace-separated list of classes
dir( ltr | rtl )#IMPLIEDdirection for weak/neutral text
enctype CDATA "application/x-www-form-urlencoded"media type as per RFC2045
idID#IMPLIEDdocument-wide unique id
langNMTOKEN#IMPLIEDlanguage code (backwards compatible); language code as RFC3066
method( get | post )"get"HTTP method used to submit the form
nameNMTOKEN#IMPLIEDname of form for scripting
onclick CDATA #IMPLIEDa pointer button was clicked; script expression
ondblclick CDATA #IMPLIEDa pointer button was double clicked; script expression
onkeydown CDATA #IMPLIEDa key was pressed down; script expression
onkeypress CDATA #IMPLIEDa key was pressed and released; script expression
onkeyup CDATA #IMPLIEDa key was released; script expression
onmousedown CDATA #IMPLIEDa pointer button was pressed down; script expression
onmousemove CDATA #IMPLIEDa pointer was moved within; script expression
onmouseout CDATA #IMPLIEDa pointer was moved away; script expression
onmouseover CDATA #IMPLIEDa pointer was moved onto; script expression
onmouseup CDATA #IMPLIEDa pointer button was released; script expression
onreset CDATA #IMPLIEDscript expression; the form was reset
onsubmit CDATA #IMPLIEDscript expression; the form was submitted
style CDATA #IMPLIEDassociated style info; style sheet data
targetNMTOKEN#IMPLIEDrender in this frame
title CDATA #IMPLIEDadvisory title; text used for titles
xml:langNMTOKEN#IMPLIEDlanguage code (as per XML 1.0 spec); language code as RFC3066
Content( #PCDATA | p | h1 | h2 | h3 | h4 | h5 | h6 | div | ul | ol | dl | menu | dir | pre | hr | blockquote | address | center | noframes | isindex | fieldset | table | a | br | span | bdo | object | applet | img | map | iframe | tt | i | b | u | s | strike | big | small | font | basefont | em | strong | dfn | code | q | samp | kbd | var | cite | abbr | acronym | sub | sup | input | select | textarea | label | button | noscript | ins | del | script )*
End tagRequired </form>
Referenced in applet blockquote body center dd del div fieldset iframe ins li map noframes noscript object td th
Example
SourceAppearance
<form method="post"
action="http://www.december.com/cgi-bin/formmail.secure.cgi">
<p><input type="hidden" name="recipient" value="nobody@december.com" /></p>
<p>Your Name: <input type="text" size="15" name="user-name" /></p>
<p>Customer Number: <input type="text" size="10" name="customer-number" /></p>
<p>Shirt Size? <input type="radio" name="shirt-size" value="S" />S
<input type="radio" name="shirt-size" value="M" />M <input type="radio"
name="shirt-size" value="L" />L <input type="radio" name="shirt-size"
value="XL" />XL</p>
<p>What would you like?</p>
<p><select name="would-like" size="2" multiple="multiple">
<option>Order the product</option>
<option>Ask a question</option>
<option>Request a catalog</option></select></p>
<p>Your comments?<br />

<textarea name="comments" rows="4" cols="20">
</textarea></p>
<p><input type="submit" value="Send" /> <input type="reset"
value="Cancel" /></p></form>

Your Name:

Customer Number:

Shirt Size? S M L XL

What would you like?

Your comments?

search Search · star Market
2023-06-19 · John December · Terms © johndecember.com