homepage Welcome to WebmasterWorld Guest from 54.166.159.110
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Image add to cart Button
Jaz950

5+ Year Member



 
Msg#: 3646642 posted 1:04 pm on May 10, 2008 (gmt 0)

I'm having problems converting the grey looking add to cart button with an image button within my php script. Can anyone help me!

 

wheelie34

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3646642 posted 1:15 pm on May 10, 2008 (gmt 0)

Try changing the button from

<input type="submit" name="Submit" value="Add to Cart">

to

<INPUT TYPE="image" VALUE="Add to Cart" src="images/button.gif" border="0">

Should work

Jaz950

5+ Year Member



 
Msg#: 3646642 posted 1:29 pm on May 10, 2008 (gmt 0)

Thanks I've tried that, it worked for the html code but not the php code...

wheelie34

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3646642 posted 1:35 pm on May 10, 2008 (gmt 0)

Post your code, if your using html within the php tags you will need to \" (backslash quotes)

Jaz950

5+ Year Member



 
Msg#: 3646642 posted 12:06 am on May 11, 2008 (gmt 0)

print "<tr>\n";
print "</tr>\n";
print "<form method=\"GET\" action=\"update.php\">\n";
print "<td align=\"center\"><input type=\"image\" img src='image.php?img=checkout_btn' width=\"65\" height=\"19\" name=\"submit4\" value=\"Checkout\"></td>\n";
print "<td align=\"center\"><input type=\"submit\" name=\"submit3\" value=\"Cancel\"></td>\n";
print "<input type=\"hidden\" name=\"sessionID\" value=\"$_sessionID\"> \n ";
print "</form>\n";
print "</tr>\n";
print "</table>";
mysql_close($link);
// Close the connection
?>

wheelie34

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3646642 posted 7:56 am on May 11, 2008 (gmt 0)

I would say this line is the problem.

img src='image.php?img=checkout_btn'

change it to

src=\"images/checkout_btn.gif\"

That's assuming your button is IN the images folder and IS called checkout_btn.gif

Jaz950

5+ Year Member



 
Msg#: 3646642 posted 8:13 am on May 11, 2008 (gmt 0)

the checkout button is the one on the left of the cancel button...

jatar_k

WebmasterWorld Administrator jatar_k us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3646642 posted 11:50 am on May 11, 2008 (gmt 0)

it's a path issue, that image is 404 because you have this

<input type="image" img src="images\checkout.png" width="65" height="19" name="submit4" value="checkout">

instead of

<input type="image" img src="images/checkout.png" width="65" height="19" name="submit4" value="checkout">

your slash is going the wrong way

Jaz950

5+ Year Member



 
Msg#: 3646642 posted 12:05 pm on May 11, 2008 (gmt 0)

I've tried the code you've just given and the page does not even load up at all and also I don't think it's the slash either as the code doesn't look correct in dreamweaver.

jatar_k

WebmasterWorld Administrator jatar_k us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3646642 posted 12:11 pm on May 11, 2008 (gmt 0)

take a look at the source of the page in your browser, that's where the final output is

when I paste the path you have and then change the slash the image works

Jaz950

5+ Year Member



 
Msg#: 3646642 posted 12:09 am on May 12, 2008 (gmt 0)

I have changed the slash as suggested and now the web page is completely blank now...I'm stuck

jatar_k

WebmasterWorld Administrator jatar_k us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3646642 posted 3:02 pm on May 12, 2008 (gmt 0)

have you viewed the source of that page?

do you get errors? maybe a parse error that isn't displaying?

Jaz950

5+ Year Member



 
Msg#: 3646642 posted 3:21 pm on May 12, 2008 (gmt 0)

Thanks, now I've been able to replace the button, it worked in mozilla but not in internet explorer. Here's the script I used...

print "<td align=\"right\"><input type=\"image\" src=\"images/checkout.png\" name=\"submit\" value=\"add\"></td>\n";

and I can't seem to fix it.

jatar_k

WebmasterWorld Administrator jatar_k us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3646642 posted 3:27 pm on May 12, 2008 (gmt 0)

then it is likely an html error

did you try validating the page to see if it shows anything?

another tip

if you want to avoid having to escape all those quotes you can surround the outside with single quotes like so

print '<td align="right"><input type="image" src="images/checkout.png" name="submit" value="add"></td>' . "\n";

notice that I split out the \n at the end and put it in double quotes. It won't be a newline if it is in single quotes

Jaz950

5+ Year Member



 
Msg#: 3646642 posted 3:35 pm on May 12, 2008 (gmt 0)

How do you validate a page?

jatar_k

WebmasterWorld Administrator jatar_k us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3646642 posted 3:36 pm on May 12, 2008 (gmt 0)

go here
[validator.w3.org...]

and it will check the page and return errors if there are any

Jaz950

5+ Year Member



 
Msg#: 3646642 posted 3:43 pm on May 12, 2008 (gmt 0)

Thank you

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved