Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple actions for on form 1

Status
Not open for further replies.

TheConeHead

Programmer
Joined
Aug 14, 2002
Messages
2,106
Location
US
how can I have two buttons in one form perform 2 different actions (action="newpage.html")?

[conehead]
 
If they have to be in the same form, you'd have to either:

1. Use JavaScript, or
2. Use server-side code to detect which button was pressed, and redirect accordingly.

Ifg you know your users will have JavaScript enabled, this would change the default form action before submitting:

Code:
<input type="submit" onclick="this.form.action = 'place1.asp';" value="Submit to place 1" />
<input type="submit" onclick="this.form.action = 'place2.asp';" value="Submit to place 2" />

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top