Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

problem with image as submit button

images php coding issues or problems here.

Moderators: macek, egami, gesf

problem with image as submit button

Postby NewPHP » Sun Sep 18, 2011 9:39 pm

Code: Select all
<form name="leaveform" method="post" action="#">
Approve:<input type="radio" name="leave" value="1" />Yes
           <input type="radio" name="leave" value="0" />No
<input type="image" name="submit" src="http://images.cooltext.com/2260257.png" width="97" height="61" alt="Approve" />
</form>
<?php
if(isset($_POST['submit']))
         {
                  $leave=$_POST['leave'];
                 $sql="UPDATE leave SET approve='$leave' WHERE lid='$lid'";
                 $result = mysql_query($sql) or die(mysql_error());

                        }
?>
 


This is my code for leave approval.But when i click the submit button(image),it didn't take the value of form elements.So-that i couldn't update the database.The funny thing is that,this code is working in firefox,but not in IE.Could anyone please tell me ,what is the problem of this code?
NewPHP
New php-forum User
New php-forum User
 
Posts: 47
Joined: Thu Sep 01, 2011 4:37 pm

Re: problem with image as submit button

Postby NewPHP » Mon Sep 19, 2011 3:58 pm

Hi all,
I corrected my mistake like:
<button name="Submit" type="submit" >
<img src="http://images/260257.png" border="0" width="55" height="35" />
</button>

Then it is working in both IE and firefox
NewPHP
New php-forum User
New php-forum User
 
Posts: 47
Joined: Thu Sep 01, 2011 4:37 pm

Re: problem with image as submit button

Postby webinfopedia » Sun Sep 25, 2011 10:04 pm

Hi,

try this code..
Code: Select all
<input type="image" name="submit" id="submit" src="http://images.cooltext.com/2260257.png" width="97" height="61" alt="Approve" />

Hope this will work..

Thank You
User avatar
webinfopedia
New php-forum User
New php-forum User
 
Posts: 84
Joined: Sat May 21, 2011 10:26 pm


Return to PHP coding => Images

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron