HTML <form> action attribute

Definition and Usage

action The attribute specifies where to send the form data when submitting the form.

Example

When submitting a form, send the form data to a file named "action_page.php" (used for processing 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

Syntax

<form action="URL">

Attribute Value

Value Description
URL

Specifies where to send form data when a form is submitted.

Possible Values:

  • Absolute URL - Points to another website (e.g., action="http://www.example.com/example.html")
  • Relative URL - Points to a file within a website (e.g., action="example.html")

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support