Visit Original Non-AMP Page

How to Make Submit button redirect to another page in HTML

If you are Wondering about, How to Make Submit button redirect to another page in HTML. Then this Tutorial is for You.
Because In this Tutorial, we are performing some methods to Make Submit button redirect another page using HTML.
We can use HTML Form, Anchor or JavaScript inside HTML to Redirect our users by HTML Submit button.

Redirect using HTML Forms

To make Submit button redirect to another page we can use HTML Form Tags.
Which will allow us to Redirect or Open another Webpage using Submit button Click.
We just need to Write our Webpage path under the HTML Form’s Action attribute (We we want to Redirect). It will redirect our user to given Path/Webpage.

<html>
   <head>
     <title>Submit Button Redirect</title>  
   </head>    
    <body>     
     <form method="POST" action="myPage.php">  
       <input type="submit"/>  
     </form>    
    </body>    
</html>

Link Submit button using Anchor Tags in HTML

Linking Submit buttons using Anchor Tag is Easy and Reliable method in HTML. We need to Write/Declare Submit button between Anchor tag’s Starting and Closing tags.
By using Anchor tag’s HREF attribute we can give a Path where we want to Link our Submit Button.

<html>    
   <body> 
    
     <a href="http://programminghead.com">  
      <input type="submit"/>  
     </a>
    
   </body>    
</html>

Link Submit button to Another page using JavaScript

If you don’t need to use Form tag or Anchor tags to Link Submit button to a different page in HTML then we can use JavaScript for such cases. In JavaScript, we design a Function which will manage all the Data like Page Path where we want to Connect our Submit Button. The function name, By using that Function name we can call that function within HTML onClick attribute. Which we call the assigned function and we can redirect our users from one page to another by clicking on the Submit Button.

<html>    
  <body> 
    
    <input type="submit" onClick="myFunction()"/> 

    <script>
      function myFunction() {
        window.location.href="http://programminghead.com";  
      }
    </script>
    
  </body>    
</html> 

JavaScript button to another site

Using JavaScript OnClick Event you can redirect users to Another page on a Single click.
So if you want do JavaScript button to another site Redirect thing.
Then use this Code Given Below.

<button onClick="window.location.href='http://programminghead.com';">  
   Click ME  
</button> 

FAQs about: How to Link Submit Button in HTML

submit button redirect to another page HTML

To redirect users to another page using Submit button we can use HTML’s Ancher tag or Form tags for that.
In Anchor tags and Form Tags, we need to Write/Declare our Submit button between Anchor tags or Form Tags.
Which will make our Submit button Clickable. And by using Anchor and Form tag’s href attribute we can Specify the Path where we want our users to redirect after clicking the Submit Button.
Redirect using HTML Form Tags

<html>    
  <body> 
    
   <form action="nextpage.php" method="POST">  
     <input type="submit"/>  
   </form>
    
  </body>    
</html>
<html>    
    <body> 
    
     <a href="http://programminghead.com">  
       <button>Click Me</button>  
     </a>
    
    </body>    
</html>

how to make a button or a page link to another page in HTML using the button

Just write/Declare your HTML Button inside HTML Anchor tags <a>. Anchor tags will make our HTML Buttons Clickable and after that, you can use Anchor tag’s href attribute to give the Path to your Button.

 <html>    
    <body> 
    
     <a href="http://programminghead.com">  
       <button>Click Me</button>  
     </a>
    
    </body>    
</html>

how to handle multiple submit buttons in HTML forms

In HTML Forms all the Buttons inside Form Tags will work like a Submit button. Which will redirect users to the same page (Which we have declared inside HTML form’s action attribute) If you want to Handle multiple Submit buttons then you can use Multiple Form tags with multiple Page Path. or you can use Anchor tags instead of Form tags to redirect Users using multiple submit buttons in HTML link submit button to another page using JavaScript.

<html>
  <body> 
    
    <input type="submit" id="submitBtn"/>  

    <script>
      document.getElementById("submitBtn").addEventListener("click", myFunction);  
      function myFunction() {  
        window.location.href="http://programminghead.com";  
      }
    </script>
    
  </body>
</html>

JavaScript windows.location allows us to redirect our users to another page on a single click. We just need to add a Click event inside our JavaScript. Which will run when user Invoke the Click Event by clicking the Submit button.

a href Submit form onclick

Yes you can Link / Open another page using HTML Anchor Tags / A Href Method. For that you have to provide your Another page’s Link inside Anchor tags href attribute. Which will open your Linked page on a Single Click.

  <html>
    
    <body> 
    
     <a href="myNextPage.html">  
       Click Me 
     </a>
    
    </body>
    
  </html>

redirect to another page after form submit HTML

If you want to redirect to another page after form submit html, Then you have to provide/Sign the Other pages path inside HTML Form tag’s ACTION Attribute. Which will POST/Send your Form data to that Location and Open/Redirect your Users to That Given Web Page.

  <html>
    
    <body> 
    
     <form method="POST" action="anotherPage.php">  
      <input type="text"/> 
      <input type="submit"/> 
     </form>
    
    </body>
    
  </html>

button type submit redirect to another page

To make button type submit redirect to another page, You can use HTML Anchor tags <a>.
Where you need to write your HTML Button [button type submit] between these HTML Anchor Tag’s starting <a> and Closing </a> Tags.

<a href=“yourPathHere“>
Your Button Here..
</a>

or you can use HTML Form Tags to do the Same thing.

<form action=”YourPathHere”>
<input type=”submit”/>
</form>

Example 1 : button type submit redirect to another page

<html>
<body>
  <a href="http://programminghead.com">  
    <input type="submit"/>  
  </a>
</body>
</html>

Example 2: Button Type Submit redirect

<html>
<body>
  <form action="http://programminghead.com">  
    <input type="submit"/>  
  </form>
</body>
</html>

html button click redirect

By using HTML Anchor Tags <a>..</a>, you can Redirect on a Single Button Click [html button click redirect].
To use HTML Anchor tags to redirect your User to Another page, you need to write your HTML Button between these HTML Anchor Tag’s starting <a> and Closing </a> Tags.

<a href=“yourPathHere”>
<button>HTML Button</button>
</a>

<html>
<body>
  <a href="http://programminghead.com">  
    <button>Click ME</button>  
  </a>
</body>
</html>

I hope this Tutorial Resolved all of your Queries about How to Make Submit button redirect to another page in HTML.
Thanks for visiting our Website. Have a Great Time.