Advertisement
Home Open Editor ❯

HTML action Attribute

Example

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

Try this code ❯

Meaning

The action attribute contains the URL of the server program that will process the contents of the form.

Some browsers also might support a mailto URL, which can mail the results to the specified address.

Otherwise, the delivery of the data in the form is defined by the method attribute.


Standard Syntax

<form action="URL">


Applies to:

The action attribute can be used on the following element:

Element Attribute
<form> action

Advertisement

Attribute Values

Value Description
URL

Value can be

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