Problems with using an image for a submit button in a form

liunx

Guest
I would like to use an image instead of an ugly submit button. Here is my code:<br />
<br />
<!--This doesn't work--><br />
<br />
<form name='form$x' method='post' action='projLeads.php'> <input type='hidden' name='ID' value='$jobID'><br />
<input type='image' src='http://www.htmlforums.com/archive/index.php/images/remove.gif' alt='Delete' name='Delete' width='13' height='15'><br />
</form><br />
<br />
<!--This does--><br />
<br />
<form name='form$x' method='post' action='projLeads.php'> <input type='hidden' name='ID' value='$jobID'><br />
<input type='submit' name='Delete' value='Delete'><br />
</form><br />
<br />
This is the code that processes the form:<br />
<br />
<?PHP<br />
if($Delete) {<br />
$conn = db_connect();<br />
//declare query<br />
$query = 'DELETE FROM currProjects WHERE id="'.$ID.'"';<br />
//execute query<br />
$result = mysql_query($query);<br />
//declare query<br />
$query = 'DELETE FROM invoices WHERE id="'.$ID.'"';<br />
//execute query<br />
$result = mysql_query($query);<br />
//declare query<br />
$query = 'DELETE FROM contracts WHERE id="'.$ID.'"';<br />
//execute query<br />
$result = mysql_query($query);<br />
}<br />
?><br />
<br />
So the first bunch of coding is what I want to get to work. The second works. The third is just to give you a better idea as to what I'm trying to do, it works.<br />
<br />
How can I use the image submit button to work properly as a submit button?<!--content-->Courtesy of <!-- m --><a class="postlink" href="http://www.draac.com/css/csstricks.html">http://www.draac.com/css/csstricks.html</a><!-- m --> I present for your edification:<br />
<br />
<form name='form$x' method='post' action='projLeads.php'><br />
<input type="submit" style="background-image: url(filename.gif); color: #0000cd; font-weight: bold; font-size: 13pt;"><br />
</form> <br />
<br />
Hopefully, that'll do it for you.<br />
<br />
Neil<!--content-->that might look the same if the button used no border, other wise it looks like a regular form button except it has a background image. And when clicked on it will move in/out like a form button.<br />
<br />
Try this and see if PHP works similar to Perl in this regards, instead of:<br />
<br />
if($Delete)<br />
<br />
try this:<br />
<br />
if($Delete.x)<br />
<br />
the .x is the x (as in x,y) coordinate of the cursor over the image button<!--content-->You're right Kevin - at least about the border needing to be zero. You'll also need to specify the width and height of the image in the inline style. Therefore it looks like:<br />
<br />
<form name='form$x' method='post' action='projLeads.php'><br />
<input type="submit" value="Delete" alt='Delete' name='Delete' <br />
style="background-image: url(images/yourimage.gif); color: #0000cd; border: 0; font-weight: bold; font-size: 13pt; width:100; height:20"><br />
</form><br />
<br />
That works just fine. :D<br />
<br />
Neil<!--content-->cool... :D<!--content-->
 
Back
Top