-
input type=image
PHP Code:
<input name="priceOption" type="image" id="priceOption" value="4" src="/images/order.gif" border="0" alt="Order" title="Order">
I do a print_r($_POST) and the priceOption value shows up in the array except when i'm in IE.
Has anyone found a work around for this?
-
there's no reason why this code not work on ie
-
ie don't send image's name if you submit the form by hitting enter in input box.
-
I'm not trying to get an image name. Just the variable priceOption and value. Go ahead and paste the code it will not show up in ie.
-
I made a simple test script:
PHP Code:
<?php
print_r($_POST);
echo '<form method="post" action="'.$_SERVER[PHP_SELF].'" >';
echo '<input name="priceOption" type="image" id="priceOption" value="4" src="/images/order.gif" border="0" alt="Order" title="Order">';
echo '</form>';
?>
Result in Firefox:
PHP Code:
Array
(
[priceOption_x] => 21
[priceOption_y] => 8
[priceOption] => 4
)
Result in IE
PHP Code:
Array
(
[priceOption_x] => 14
[priceOption_y] => 3
)
priceOption doesn't show up in IE.
-
-
Anyway, input type=image is treated differently is mozilla/ie, so it's good reason not to rely on it. If you need a form with mutiple image submits, give them unique names
<input type=image name=priceOption1>
<input type=image name=priceOption2>
<input type=image name=priceOption3> etc
In form processing logic check if one of those exists:
priceOption1
priceOption1_x
priceOption1.x
-
That's what i ended up doing and stripping the x out to use as my value. I hate IE.
-
quote from W3C
"
value = cdata [CA]
This attribute specifies the initial value of the control. It is optional except when the type attribute has the value "radio" or "checkbox".
"
I don't like IE either, but in this case... :)