How to fix IE to see multiple input image button’s for PHP.
Wednesday, January 6th, 2010 at 2:18 pmIE never ceases to piss me off! I’ve been working on this shopping for one of my site, and I have several button’s within the same form, depending on which one you choose will send you to a different page. In my case an update button and checkout button. The problem is with IE, it doesnt recognize a button as a HTML input DOM. The traditional name and value gets translated into ?name=value, in IE it see’s it as a sorta of image map. When you click the image button all it sends are the coordinates on the button you clicked. As in action_update.x=10 action_update.y = 9. Because of that the standard $_REQUEST['action_update'] wont work. Here is the code I used to fix it so I can tell if someone clicked a certain button. Heres the code for the fix.
HTML:
1 2 3 4 5 6 | <form>
<input type="image" src="button_image.jpg" name="action_update"
value="update" />
<input type="image" src="button_image.jpg" name="action_checkout"
value="checkout" />
</form> |
PHP:
1 2 3 4 5 6 7 8 9 10 | <?PHP
if($_REQUEST['action_update']=='update'||
isset($_REQUEST['action_update_x'])) {
/* do something */
}
if($_REQUEST['action_checkout']=='update'||
isset($_REQUEST['action_checkout_x'])) {
/* do something */
}
?> |
Hope that helps
Jason Rogers















