HTML Dog
Skip to navigation

HTML Tag: form

Form, typically used to facilitate the submission of user-inputted data.

Used with elements such as input, select and textarea to create form controls.

Optional Attributes

Attribute Description Possible values
action The address to which submitted form data should be sent to. URL.
method The HTTP method by which submitted form data should be sent.
  • get: Bolts the form values onto the URL that the form is submitted to. Used for simple data sending, such as search queries, for example.
  • post: Invisibly sends the form data in the body of the submitted HTTP request. Used for more detailed or secure data sending, such as contact forms, for example.
enctype The MIME type used to encode the form data.
  • application/x-www-form-urlencoded: Default.
  • multipart/form-data: For when a file input element is used in the form.
  • text/plain: Basic text.
accept-charset The character encoding(s) of the submitted data. A character encoding, such as utf-8, or several separated by spaces
autocomplete Sets the default autofill of controls in the form.
  • on (default)
  • off
name The unique name of a form, used when a page contains more than one form. Text.
novalidate Indicates that the form should not be validated before it is submitted. None.
target The browsing context in which the submitted form’s destination URL should open.
  • _self: Opens in current window / tab.
  • _blank: Opens in a new window / tab.
Global attributes

Example


<form action="someKindOfProcessingScript.php" method="post">
    <label for="housenumber">House number</label>
    <input name="housenumber" id="housenumber">

    <label for="street">Street</label>
    <input name="street" id="street">

    <input type="submit">
</form>