# form

Defines an interactive form with controls.

Example: Copy








<form action="/signup" method="post">
  <p>
    <label>Title</label><br>
    <label>
      <input type="radio" name="title" value="mr">
      Mr
    </label>
    <label>
      <input type="radio" name="title" value="mrs">
      Mrs
    </label>
    <label>
      <input type="radio" name="title" value="miss">
      Miss
    </label>
  </p>
  <p>
    <label>First name</label><br>
    <input type="text" name="first_name">
  </p>
  <p>
    <label>Last name</label><br>
    <input type="text" name="last_name">
  </p>
  <p>
    <label>Email</label><br>
    <input type="email" name="email" required>
  </p>
  <p>
    <label>Phone number</label><br>
    <input type="tel" name="phone">
  </p>
  <p>
    <label>Password</label><br>
    <input type="password" name="password">
  </p>
  <p>
    <label>Country</label><br>
    <select>
      <option>China</option>
      <option>India</option>
      <option>United States</option>
      <option>Indonesia</option>
      <option>Brazil</option>
    </select>
  </p>
  <p>
    <label>
      <input type="checkbox" value="terms">
      I agree to the <a href="/terms">terms and conditions</a>
    </label>
  </p>
  <p>
    <button>Sign up</button>
    <button type="reset">Reset form</button>
  </p>
</form>

action

Defines which URL the form's information is sent to when submitted.

"/contact"

You can use a relative URL.

"http://htmlreference.io/contact"

You can use an absolute URL.

method

Defines the HTTP method used when submitting the form.

"post"

The form information is sent to the server as part of the request body.

"get"

The form information is sent to the server as part URL parameters: /contact?first_name=Alex&last_name=Smith.

name

The form's name when sent to the server. Useful when multiple forms are present on the same web page.

"sign_up_form"

The name value must be unique within the context of the whole web page.

It can only contain alphanumeric characters a-z A-Z 0-9 and some special characters like - _… but no space.

autocomplete

Determines if the browser can autocomplete all the form's controls.

"off"

The browser will disable autocomplete functions. This can however be overriden for each control individually.

"on"

The browser will enable autocomplete functions. This can however be overriden for each control individually.

Try pressing "down" in this input. It will show previously entered email addresses.

target

Defines in which tab or window the clicked link will show up.

"_blank"

Opens in a new browsing context, which is usually a new tab.

"_self"

Opens in the current tab.

"_parent"

Opens in the parent browsing context, or _self is there is none.

"_top"

Opens in the top browsing context, or _self is there is none.

enctype

Defines the MIME type of the information sent to the server. Only works if the method is post.

"application/x-www-form-urlencoded"

Default.

The default value.

"text/plain"

For HTML5 plain text.

"multipart/form-data"

Needed when using an <input type="file"> element.

novalidate

Tells the browser to not validate the form on submission.

No value required.