3

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?

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
Vbabey
  • 113
  • 1
  • 2
  • 10

2 Answers2

7

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';">
AnaMaria
  • 3,520
  • 3
  • 19
  • 36
  • @AnaMaria I don't intend to offend you in anyway, but from my perspective persuading the OP for upvotes is impolite. So just a friendly suggestion :) – egghese Jul 29 '13 at 12:01
  • @JeslyVarghese, i did not persuade the OP for anything. I only told him that he can mark either my soloution as answer or any other. I just added that he/she should also consider marking +1 to everyone who tried to help. Nothing wrong in that. Helps everyone – AnaMaria Jul 29 '13 at 12:09
  • :) , you can see here fun comments!!! @AnaMaria and Jeslu Varghese ,after read your comments , i can imagine your faces ;),BTW thanks AnaMaria – Hamid Talebi Mar 16 '14 at 21:15
2

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>
Kindoloki
  • 594
  • 5
  • 18
  • I got the point now. I had some misunderstanding about the
    tag...I got the whole point. Its a good explaination.
    – Vbabey Jul 29 '13 at 11:00