Saturday , 23 May 2015
Home » PHP Programming » Common Issues/Bugs » Input type Image not working in Firefox
Input type Image not working in Firefox

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

About Rakshit Patel

I am PHP Freelancer, Rakshit Patel AKA WordPress Freelancer working as PHP Programmer India. I am here to share all my developing knowledge, quick coding techniques, quick solutions to save your time and help you guys for any issue or bug fixing. If you have any PHP, WordPress, Magento related work, please contact me. I am interested for the work.

One comment

  1. 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. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>