Date: 2016nov21
Platform: web
Language: PHP, html
Q. How can I get two different responses from a submit?
A. The trick is to type=submit's with the same name but different value's
<form>
...
<input type=submit name=form_reply value=Yes>
<input type=submit name=form_reply value=No>
</form>
The user will see two buttons: [Yes] [No]
And your server-side code will get form_reply=Yes or form_reply=No
In PHP:
$reply = strtolower($_REQUEST['form_reply']);
if ($reply == 'yes') {
doYes();
}
else if ($reply == 'no') {
doNo();
}
else {
print "Unknown reply";
}
A potential problem with this approach is translation.
What you are displaying to the user might change to "Oui" and "Non".