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 theformaction
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
Chrome | Edge | Firefox | IE | Opera | Safari | |
---|---|---|---|---|---|---|
<action> | Yes | Yes | Yes | Yes | Yes | Yes |
Mobile
Android Webview | Chrome Android | Firefox Android | Opera Android | iOS Safari | Samsung Internet | |
---|---|---|---|---|---|---|
<action> | Yes | Yes | Yes | Yes | Yes | Yes |