The HTML | action Attribute is used to specify where the formdata is to be sent to the server after submission of the form. It can be used in the <form> element.
Syntax:
<form action="URL">
Attribute Values:
URL: It is used to specify the URL of the document where the data to be sent after the submission of the form.
The possible values of the URL are:
- absolute URL: It points to another website link. For Example: www.gfg.org
- relative URL: It is used to point to a file within a webpage. For Example: www.geeksforgeeks.org
Example-1: This Example illustrates the use of action Attribute.
<!DOCTYPE html> <html> <head> <title> HTML action Attribute </title> </head> <body> <h1>GeeksforGeeks</h1> <h2>HTML action Attribute</h2> <form action="test.php" method="post" id="users"> <label for="username"> Username: </label> <input type="text" name="username" id="Username"> <br> <br> <label for="password"> Paswword: </label> <input type="password" name="password"> </form> <br> <button onclick="myGeeks()"> Submit </button> <br> <br> <b>After Submitting the form-data will sent to the "test.php" page on the server.</b> </body> </html> |
Outputs:

Supported Browsers: The browser supported by HTML action Attribute are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari
Recommended Posts:
- HTML | DOM Form action Property
- Introduction to Redux (Action, Reducers and Store)
- How to wait resize end event and then perform an action using JavaScript ?
- HTML | <html> xmlns Attribute
- HTML | scoped Attribute
- HTML | <th> valign Attribute
- HTML | <col> align Attribute
- HTML | poster Attribute
- HTML | Class Attribute
- HTML | style attribute
- HTML | <area> target Attribute
- HTML | oninvalid Event Attribute
- HTML | <select> autocomplete Attribute
- HTML & CSS | Tabindex attribute & Navigation bars
- HTML | <table> bgcolor Attribute
- HTML | onsubmit Event Attribute
- HTML | onunload Event Attribute
- HTML | srcdoc Attribute
- HTML | Marquee truespeed attribute
- HTML | onkeyup Event Attribute
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


