开发者

Form processing problem with input type 'image'

For example i use this little code:

 <?php
      if (isset($_POST['Submit'])){
            if ((@$_POST['Submit'] == 'x'))
            {
           echo "OK";exit;

            }else{
           echo "NOT";

            }
      }
?>

    <html>
    <body>
    <form action="test.php" method="post" enctype="multipart/form-data">
    <input name="Submit" type="image" src="images/table/button.png" value="x" >
    </form>
    </body>
    </html>

In Mozilla (3.5.5) works well, after submit OK was printed. I test it on IE8 and Opera 10, and not work. Nothing printed. The form not proccessed after hit, just reload 开发者_JAVA技巧the page.

Could you help me, how can i use image for submitting form, to work all browser? Thank you.


I can't see your code because it got cut, but let me guess. You are testing like this:

if($_POST['Submit'])

while you should test like this:

if($_POST['Submit_x'])

because the image inputs will send Submit_x and Submit_y, and not Submit (but certains browser send this too, so you should contemplate various cases).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜