Looking to Build/Redesign a Website or Blog ?

To speak to Rakshit, call +91 968 704 2303

Input type Image not working in Firefox


Hello Friends,

I am PHP Developer and my web designer gives me HTML pages in which submit button placed with input type image. Obviously input button needs to show image instead of text and can not be done with CSS as its fancy fonts so web designer makes it in image and put it with input type image.

When i code in that page, when i press on that input type image button to submit form in firefox, it was giving me x and y coordinates for the input type image button. Below is the code.

<input type="image" name="btn_submit" src="path/images/submitbg.png" />

I was expecting to get $_POST[‘btn_submit’] value to process the form data with database. Instead of $_POST[‘btn_submit’], I am getting $_POST[‘btn_submit.x’] and $_POST[‘btn_submit.y’] in firefox while $_POST[‘btn_submit’] is working in Crome and other browsers.

To make it work with all browsers, you need to change the input type image to input type submit and give the image in background of input type button. Here is the code.

<input style="background: url('path/images/submitbg.png');" type="submit" name="btn_submit" value="" />

Above will work in all browsers. I hope this helps you. :)


1 Comment

  • Tom Miller

    Why are you looking for $_POST[‘btn_submit’] in the first place? I have always used a hidden field to trigger the form processing due to an over sight in I.E..

Leave a Reply

Your email address will not be published.