Let's say I have a form with 4 buttons on it: Add, Subtract, Multiply, and Divide. When a user clicks a button, it initiates the form action and takes me to my PHP script where I use a switch statement to branch into the appropriate code. I can get this to work fine.
But let's say I don't want to use the standard HTML buttons and want to use images instead. How do I pass a value based on the image that is clicked?
How can I get what image button was clicked?
<?php
switch($button)
{
case "add":
$answer = $var1 + $var2;
echo ("Your answer is $answer.");
break;
case "subtract":
$answer = $var1 - $var2;
echo ("Your answer is $answer.");
break;
case "multiply":
$answer = $var1 * $var2;
echo ("Your answer is $answer.");
break;
case "divide":
$answer = $var1 / $var2;
echo ("Your answer is $answer.");
break;
default:
echo ("You've failed but var1 is $var1 and var2 is $var2");
}
?>
Can somebody point me to some sample code or tutorials?
Thanks,
--zbert