Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to redirect a html page to two other html pages using two buttons?

I can connect to another html page by using the following code by using a button click.

<form action="where-you-want-to-go"><input type="submit"></form>

but I have a problem. When there are two buttons on the page how can I redirect them to two different pages by using this code? Or is there any other way to do that?

like image 453
Vbabey Avatar asked Feb 03 '26 01:02

Vbabey


2 Answers

YOU COULD DO something like this

<input type="button" onclick="window.location = 'where-you-want-to-go';">
<input type="button" onclick="window.location = 'where-you-want-to-go';">
like image 198
AnaMaria Avatar answered Feb 05 '26 20:02

AnaMaria


What do you mean by "redirect"? After clicking submit button the form data is send to action url. If you want you can create two forms:

<form action="action-first"><input type="submit"></form>
<form action="action-second"><input type="submit"></form>

But if you don't want to send data, you can use links to go to the page:

<a href="/action-first">First link</a>
<a href="/action-second">Second link</a>
like image 31
Kindoloki Avatar answered Feb 05 '26 21:02

Kindoloki



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!