oshirowanen
oshirowanen

Reputation: 15925

2 submit buttons

I have a webpage which has 2 submit buttons.

How do I post a value to another page based on the button clicked.

Lets say the 2 buttons on the form are yes and no. If the yes button is clicked, I want to post the value 1, if the no button is clicked, I want to post the value 0.

Does anyone know how to do this?

It does not have to post 1 and 0, it can post any value, as long as the page being posted to knows which option was selected.

Upvotes: 1

Views: 102

Answers (2)

Bashorings
Bashorings

Reputation: 384

This seems to be what you are looking for: http://www.chami.com/tips/internet/042599i.html

Upvotes: 0

Piskvor left the building
Piskvor left the building

Reputation: 92752

<input type="submit" name="thisismysubmitbutton" value="yes" />
<input type="submit" name="thisismysubmitbutton" value="no" />

One displays and posts the value yes, the other displays and posts the value of no. Note that the input element needs to have a valid name attribute, else the value is not posted.

Upvotes: 4

Related Questions