HTML / HTML Attributes

HTML Action Attribute

Dec 12, 2022
2 min read
HTML action Attribute

Definition

The action Attribute specifies the URL where the <form> data is sent on submission.

Applicable Elements

The action Attribute can be used with the following elements:

HTML <form> action Attribute

The <form> tag is used to create an HTML form that contains controls for submitting user information.

The action attribute specifies where to send the form data on submission.

Syntax

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

Usage

  • The action attribute specifies the URL that processes the form submission.
  • The URL must be valid.
  • The action attribute can be overriden by the formaction attribute on some elements, including <button>, <input type="submit">, or <input type="image">.

Values

Values can include:

  • The URL that processes the form submission.

Examples

The following example sends the form data to the action_page.php URL, which then processes the data.

<form action="/action_page.php" method="get" class="form">
  <fieldset class="fieldset">
    <label for="name">Name: </label>
    <input type="text" name="name" id="name">
  </fieldset>
  <div class="form-example">
    <input type="submit" value="Subscribe!">
  </div>
</form>

Specification

The action HTML specification for the <form> element is as follows:

Browser Support

The action attribute has the following browser support:

Desktop

ChromeEdgeFirefoxIEOperaSafari
<action>YesYesYesYesYesYes

Mobile

Android WebviewChrome AndroidFirefox AndroidOpera AndroidiOS SafariSamsung Internet
<action>YesYesYesYesYesYes