How to link submit button to diffrent page | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to link submit button to diffrent page

23rd Jun 2017, 3:14 PM
Mayank Choubey
Mayank Choubey - avatar
6 Answers
+ 2
as Netkos said too just do this <form method="post" action="other.php"> <input type="text" name="text"> <input type="submit">OK</input> </form> you can put any path at the action where the php file is and you can also use ajax using little js or jQuery. to make a button that opens another page using anchor tag <a href="other.html"><button>Go</button></a> or as Netkos said you can do a js redirect too of navigator which doesn't need php redirect.
23rd Jun 2017, 5:28 PM
Sandeep Chatterjee
+ 1
Is your submit button part of a form? If so, you can set the other page as the 'action.' That's where it'll submit the data to for processing. If you're not using a form, you can easily use jQuery/AJAX to send data to another page for processing. If you're simply wanting to click a button and have it redirect you, you can make the button a link by using the anchor tag...or you can use JS to redirect...or jQuery to redirect... etc.. What's your actual goal and maybe I can give you a more specific answer?
23rd Jun 2017, 4:03 PM
AgentSmith
+ 1
i want to simply redirect my button to other page please give code
24th Jun 2017, 1:21 AM
Mayank Choubey
Mayank Choubey - avatar
+ 1
do this. <a href="www.google.com"><button>Click</button></a> or <button onclick="redirect()">Click</button> <script> function redirect(){ window.location.href="www.google.com"; } </script>
24th Jun 2017, 5:25 AM
Sandeep Chatterjee
+ 1
Can you please explain your need
17th Sep 2017, 5:10 PM
Shine Santhosh
Shine Santhosh - avatar
0
i will have to write thier window.location.href
31st Aug 2017, 3:58 AM
Mayank Choubey
Mayank Choubey - avatar