Advertisement
Home Open Editor ❯

HTML <input> formaction Attribute

Example

<form action="action.php">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname">

  <label for="lname">Last name:</label>
  <input type="text" id="lname" name="lname">

  <input type="submit" value="Submit">
  <input type="submit" formaction="action2.php" value="Submit to another page">
</form>

Try this code ❯

Meaning

The formaction attribute specifies a URL to target when the button is clicked, similar to the use of the action attribute on a form element.

The formaction attribute is valid for the image and submit input types only.


Standard Syntax

HTML: <input formaction="URL">

XHTML: <input formaction="URL"/>


Advertisement

Attribute Values

Value Description
URL

Value can be

  • An absolute URL - navigate to within or another web site ( href="http://www.example.com/index.html")
  • A relative URL - navigate to within a web site ( href="index.html")
Home Open Editor ❯
Advertisement