开发者

Why image button dont work with forms in IExplorer 7+ ??? (Html)

i have a web form who send post开发者_如何学Go variables like:

<form action="teacher.php" method="post">
<input name="pass" type="password">
<input name="quiere" type="image" value="submit" src="IMG/unlock-32.png" />
</from>

In the same page i check for a submit acction with php doing a simple isset check like:

"if (isset($_POST['quiere'])) {"

But if you do this in IE the post var "QUIERE" (the button var) does not post, the others vars are fine, and if you try this simple form in any other browser it works. I only get this form function well in IE changing the button for a normal button, instead of a image button like:

<input name="quiere" type="submit" value="submit" />

In this way, the var "quiere" get post. So, what do you think? and sorry for my english.


This is a known issue in IE6 and IE7. image inputs are not submitted with a form as you'd expect. It submits the cords instead and changes the field names with appending _x or _y . i've run into this several times in the past and found others have as well.

A fix is to check for $_POST['quiere_x'] or $_POST['quiere_y'] instead of just $_POST['quiere']


I believe this link has your answer.

IE doesn't send the name/value pair for elements. They only send the x/y coordinates. Most, if not all, other common browsers send both the name/value pair and the x/y coordinates.


http://www.codingforums.com/archive/index.php/t-79035.html

This is a known ie issue. Read above for the same.


Yup, just another annoying IE issue.

I normally do this:

<form action="teacher.php" method="post">
    <input name="pass" type="password">
    <input type="hidden" name="quiere" value="submit" />
    <input type="image" src="IMG/unlock-32.png" />
</form>

i.e. - just move the name and value attributes into a hidden field.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜