English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Directory

HTML: <form> action attribute

This article introduces the HTML form action attribute, which specifies where to send the form data when the form is submitted, with an online example demonstrating how to use the HTML form action attribute, browser compatibility, syntax definition, and detailed information about its attribute values.

 HTML <form> tag

Online Example

After submission, the form data will be sent to the file named "action_page.php" (to process the submitted data):

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML <form> action attribute usage-基础教程(oldtoolbag.com)</title>
</head>
<body>
<form action="action_page.php">
First name: <input type="text" name="FirstName" value="Mickey"><br>
Last name: <input type="text" name="LastName" value="Mouse"><br>
<input type="submit" value="Submit">
</form>
<p>Click the "Submit" button, and the form data will be sent to the server page named "action_page.php".</p>
</body>
</html>
Test it out ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the action attribute.

Definition and Usage

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

HTML 4.01 and HTML5Differences between

In HTML5 In HTML, the action attribute is no longer required.

Syntax

<form action="URL">

Attribute value

ValueDescription
URLWhere to send form data when the form is submitted.

Possible values:

  • Absolute URL - Points to another website (for example action="http://www.example.com/example.htm"

  • Relative URL - Points to a file within the website (for example action="example.htm")

 HTML <form> tag