JasonHarper Posted July 19, 2011 Share Posted July 19, 2011 Hello, I'm having a strange problem I can't seem to figure out. Traditionally in my php apps, I just use the standard html buttons. However, I've done one recently where I decided to use images as buttons. However, when a user submits a form using IE or Firefox, nothing happens. The form appears to post to the server because the fields are cleared but it's like no PHP code is executing. The page works fine in Chrome or Safari. Any idea how I can go about troubleshooting this? Thank you!!! Jason <input type="image" src="/images/button_submit.gif" name="Submit" value="Submit" alt="Submit" /> Quote Link to comment https://forums.phpfreaks.com/topic/242367-image-buttonssubmit-not-working-in-iefirefox/ Share on other sites More sharing options...
wildteen88 Posted July 19, 2011 Share Posted July 19, 2011 You need to check if $_POST['Submit_X'] or $_POST['Submit_Y'] exists not $_POST['Submit'] Quote Link to comment https://forums.phpfreaks.com/topic/242367-image-buttonssubmit-not-working-in-iefirefox/#findComment-1244813 Share on other sites More sharing options...
cssfreakie Posted July 19, 2011 Share Posted July 19, 2011 or do: <input type="submit" name="Submit" value="Submit" /> and in css input[type=submit]{ border:none; background: url(../images/button_submit.gif) no-repeat; /* make sure you set some dimensions */ } Quote Link to comment https://forums.phpfreaks.com/topic/242367-image-buttonssubmit-not-working-in-iefirefox/#findComment-1244814 Share on other sites More sharing options...
JasonHarper Posted July 19, 2011 Author Share Posted July 19, 2011 You need to check if $_POST['Submit_X'] or $_POST['Submit_Y'] exists not $_POST['Submit'] Thank you! So right now I have: if($_POST['Submit']) Can you help me understand what the Submit_X is? Thank you! Jason Quote Link to comment https://forums.phpfreaks.com/topic/242367-image-buttonssubmit-not-working-in-iefirefox/#findComment-1244827 Share on other sites More sharing options...
conker87 Posted July 19, 2011 Share Posted July 19, 2011 Submit_X and Submit_Y are the x and y coords of which part of the image button you clicked. Quote Link to comment https://forums.phpfreaks.com/topic/242367-image-buttonssubmit-not-working-in-iefirefox/#findComment-1244836 Share on other sites More sharing options...
wildteen88 Posted July 19, 2011 Share Posted July 19, 2011 When you use an image as the submit button the webbrowsers submit the x and y co-cordinates of the cursor where the user clicked on the button. Doing a print_r on $_POST you'd see this Array ( [submit_x] => 0 [submit_y] => 0 ) If you used a normal submit button (<input type="submit" name="Submit" value="Submit" />) you'd see this outputted Array ( [submit] => submit ) Notice how the name of submit button changes. This is what I meant by checking to see if submit_x or submit_y exists when using an image as the submit button. Quote Link to comment https://forums.phpfreaks.com/topic/242367-image-buttonssubmit-not-working-in-iefirefox/#findComment-1244839 Share on other sites More sharing options...
JasonHarper Posted July 19, 2011 Author Share Posted July 19, 2011 Worked perfectly - thank you so much! Jason Quote Link to comment https://forums.phpfreaks.com/topic/242367-image-buttonssubmit-not-working-in-iefirefox/#findComment-1244875 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.