Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

HTML| action Attribute

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The HTML | action Attribute is used to specify where the form data is to be sent to the server after the 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 is 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. 
 

HTML




<!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="name" id="username"><br><br>
 
        <label for="password">Password:</label>
        <input type="password" name="pass"  id="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>

Output: 

 

Supported Browsers: The browser supported by HTML action attribute are listed below. 

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

 

My Personal Notes arrow_drop_up
Last Updated : 13 Dec, 2022
Like Article
Save Article
Similar Reads
Related Tutorials