By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

The HTML Form Tag

Reference showing how to use the HTML Form Tag.

Edited: 2014-12-28 07:01

The Form element in HTML creates a form, this can be used to submit data to the server. The server wil handle any submitted data, with a server-side script.

Warning

Data submitted through forms should be validated on the server as well, because the client-side validation methods are easily omitted.

Atributtes

Standard atributes

Atributte:Value:Description:DTD:
AttrsOther AttributesCommon, I18n, EventSTF
actionURIserver-side form handlerSTF
methodGET|POSTHTTP submit methodSTF
enctypeContentTypeSTF
acceptContentTypeslist of MIME types for file uploadSTF
nameCharacter Dataname of formSTF
onsubmitScriptthe form was submittedSTF
onresetScriptthe form was resetSTF
accept-charsetCharacterSetslist of supported charsetsSTF
target
  • _self
  • _blank
  • _parent
  • _top
Target window of the formTF

DTD. Defines which document type the attribute is allowed. S=Strict, T=Transitional, F=Frameset.

Examples

Simple Example.

<form action="action.php" method="post">
</form>

Final Example

Complete Example.

<form action="action.php" method="post">
 <input type="text" name="name">
 <input type="text" name="email">
 <textarea cols="40" rows="5" name="textmsg"></textarea>
 <input type="submit" value="Submit">
</form>

The complete example was included to spare you the time, of looking each entry up in the reference.