You are here: Reference > HTML > attributes > action (form)

action attribute (form)

Browser support:
Sets a form processing agent. With this attribute you can set an URL to call when the form is sent.
Use it together with the method attribute that specifies the way to send.
JavaScript page for this attribute: action. You can find other example(s) there.

Possible values:

String that sets the URL to call. It can be an absolute or relative path as well. Relative paths are relative to the base URL. The base URL is the location of the current document, but it can be overridden by the base tag.
Default: this attribute has no default value.

Example HTML code 1:

This example illustrates the use of the action attribute:
Submitting data to a server:
<br />
<form action="http://example.com/sample.php" method="post">
    <input name="email" type="text" size="30" value="Enter your e-mail!" />
    <input type="submit" value="Send Your email address" />
</form>
<br /><br />

Submitting data to a server using e-mail:
<br />
<form action="mailto:support@example.com" method="get" style="border:1px solid #999999;">
    <input name="username" type="text" size="30" value="Enter your name!" />
    <br />
    <input name="location" type="text" size="30" value="Enter your location!" />
    <br />
    <input type="submit" value="Send Data as email" />
</form>
Did you find this example helpful? yes no

Supported by tags:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content