tags:

views:

65

answers:

1

Hello!

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 the page.

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

+1  A: 

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).

Palantir
You 've right. i should only check if (isset($_POST['Submit_x'])){..
Holian
If the answer was helpful, and your problem was resolved, you should accept it.
Palantir
Of course, i've just tested it many browser before accept. Thank you.
Holian
Thanks, worked like a charm.
robotoverlord