DigitalBurp!

A web developer's blog

HTML forms problem in IE6 solved

Posted by Vineet on May 12, 2009

Ah relieved!… finally my website works on IE6. A big problem solved…

Problem:
Login and signup script not working in IE6. (works fine in FF & Crome).
On clicking the submit button, nothing happens, not even an error msg.

What was wrong?
The problem was that I was using images as submit buttons in the HTML forms and not checking form submission as per IE6’s liking!

Solution: HTML allows us to use images as submit buttons

In FF and Chrome (and may be other browsers as well which I dont use), if we want to check if submit button is clicked and run a specific code, then this serves the purpose

if(isset($_POST['submit'])) {
//code to be executed
}

But IE passes the co-ordinates of click as submit_x and submit_y instead of just submit=parameter..

so to make sure that the form functions in IE, change the above code to

if(isset($_POST['submit_y']) || isset($_POST['submit_x'])) {

}

This solved the problem in my case

Doing some more G tells me that even if we check just one co-ordinate its fine.
But now I have already changed it, and I am too tired to change it back again to something else… so I’ll let that be.. :)

Thanks to: Webmasterworld forums, Google

2 Responses to “HTML forms problem in IE6 solved”

  1. emilien said

    Une petite erreur je pense :

    if(isset($_POST['submit_y']) || isset($_POST['submit_y'])) {

    doit ĂȘtre corrigĂ© comme :

    => if(isset($_POST['submit_y']) || isset($_POST['submit_x'])) {

  2. Vineet said

    Ah yes… thanks for the correction

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>