> <input type="submit" name="sample_a">
> <input type="image" name="sample_b" src="myimg.gif">
>
> With the first method, you'd need to test for a button named 'sample_a'.
> For the second method, you'd need to test for a button named 'sample_b_x'.
no ... with the first example you can have numerous buttons on the same HTML
page with the same name and use the 'value' attribute to see which one is
pressed. I did this and it works quite elegantly for my application.
<input type="submit" name="sample" value="a" >
<input type="submit" name="sample" value="b" >
<input type="submit" name="sample" value="c" >
<input type="submit" name="sample" value="d" >
your php form handler can now simply do:
print "The user selected button $sample<br>\n")
otherwise, with the image solution you'd have to do something like this...
foreach ($_GET as $button) {
if (isset($button)) {
$button_name = substr($button, -2, 0); // or whatever to remove the _x
print "The user selected button substr($button_name);
break;
}
}
Although arrays might provide a solution that wouldn't quite be as good as
the 'submit' button solution, but not as worse as a straight name-based
'image' solution.
Given that the 'button' element with "type = submit" does NOT work, maybe
the javascript solution is the most elegant. but i haven't gotten that to
work yet either!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php