THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML <form> action Attribute

❮ HTML <form> tag

Example

On submit, send the form-data to a file named "action_page.php" (to process the input):

<form action="/action_page.php" method="get">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <label for="lname">Last name:</label>
  <input type="text" id="lname" name="lname"><br><br>
  <input type="submit" value="Submit">
</form>
Try it Yourself »

Definition and Usage

The action attribute specifies where to send the form-data when a form is submitted.


Browser Support

Attribute
action Yes Yes Yes Yes Yes

Differences Between HTML 4.01 and HTML5

In HTML5, the action attribute is no longer required.


Syntax

<form action="URL">

Attribute Values

Value Description
URL Where to send the form-data when the form is submitted.

Possible values:

  • An absolute URL - points to another web site (like action="http://www.example.com/example.htm")
  • A relative URL - points to a file within a web site (like action="example.htm")

❮ HTML <form> tag