Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

How to use formaction attribute in HTML ?

  • Last Updated : 05 Oct, 2021

In this article, we will learn how to use the formaction attribute in HTML. Basically, the information attribute is used to define where to send the data of the form after submitting the form the working of formaction will begin. It overrides the feature of the action attribute of the<form> element. 

Why do we use formaction Attribute? 

Lets suppose, we have two submit buttons in one form and both the buttons work separately and redirect to another URL of the page. Both the button send data to different pages.

Values: It contains the physical address of the location of the file where to send the form data. 


Two passible values are –

  • absolute URL: It points to the full address of a page. For example “”
  • relative URL: It is used to point to a file within a webpage. For example gfg.php



<!DOCTYPE html>
        How to use formAction Attribute im HTML ?
<body style="text-align:center;">
        How to use formAction Attribute in HTML?
    <form method="get" target="_self">
        Username:<input type="email" name=ename""><br><br>
        Password <input type="password" name="passwrd"><br>
        <input type="submit" value="submit for Java User" 
        <input type="submit" value="submit for python User"


  • After Click on the Submit for Java user Button: 

  • After Click on the Submit for python user Button:

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!