There's a much easier solution to this entire issue. Simply give both buttons the same name, and then IE will submit only the value of the one that was clicked. If you need the buttons to have different identifiers, so you can tell them apart, give them different IDs. For example...
Actually this will work with IE7 but only if the value parameter is the same as the text within the <button> tag (see post by snobo - 16th October 2009).
Comment
There's a much easier solution to this entire issue. Simply give both buttons the same name, and then IE will submit only the value of the one that was clicked. If you need the buttons to have different identifiers, so you can tell them apart, give them different IDs. For example...
<form action="showRequestVariables">
<button type="submit" name="submit-button" id="button1">Button1</button>
<button type="submit" name="submit-button" id="button2">Button2</button>
</form>
Both IE and Firefox will then submit the following...
submit-button = (whichever button was pressed)
That should solve your problem. Hope that helps!
Replies
Works with IE8 but not IE7...?
Actually this will work with IE7 but only if the value parameter is the same as the text within the <button> tag (see post by snobo - 16th October 2009).
<button type="submit" name="submit-button" id="button1" value="Button1">Button1</button>
<button type="submit" name="submit-button" id="button2" value="Button2">Button2</button>