How to specify the response page after submitting the form using HTML5 ?

In this article, we will specify the response page after submitting the form by using the action attribute in the <form> element in the document. This property is used to specify the URL page or destination of the form data that to be sent to the server after submission of the form. It can be used in the “form” element.

Syntax:

<form action="URL">

Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <title>
        How to Specify where to display the
        response that is received after 
        submitting the form using HTML5?
    </title>
</head>
  
<body>
    <h1>GeeksforGeeks</h1>
  
    <h2>
        How to Specify where to display the
        response that is received after 
        submitting the form using HTML5?
    </h2>
  
    <form action="test.php" method="post" id="users">
  
        <label for="username">
            Username:
        </label>
  
        <input type="text" name="username" id="Username">
  
        <br>
  
        <label for="password">
            Password:
        </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>

chevron_right


Output :

Supported Browsers are listed below:

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

full-stack-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

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.