Welcome to WebmasterWorld Guest from 54.234.38.8

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Image add to cart Button

     
1:04 pm on May 10, 2008 (gmt 0)

New User

5+ Year Member

joined:May 10, 2008
posts: 11
votes: 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!
1:15 pm on May 10, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 6, 2005
posts:863
votes: 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

1:29 pm on May 10, 2008 (gmt 0)

New User

5+ Year Member

joined:May 10, 2008
posts:11
votes: 0


Thanks I've tried that, it worked for the html code but not the php code...
1:35 pm on May 10, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 6, 2005
posts:863
votes: 0


Post your code, if your using html within the php tags you will need to \" (backslash quotes)
12:06 am on May 11, 2008 (gmt 0)

New User

5+ Year Member

joined:May 10, 2008
posts:11
votes: 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
?>
7:56 am on May 11, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 6, 2005
posts:863
votes: 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

8:13 am on May 11, 2008 (gmt 0)

New User

5+ Year Member

joined:May 10, 2008
posts:11
votes: 0


the checkout button is the one on the left of the cancel button...
11:50 am on May 11, 2008 (gmt 0)

Administrator

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

joined:July 24, 2001
posts:15755
votes: 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

12:05 pm on May 11, 2008 (gmt 0)

New User

5+ Year Member

joined:May 10, 2008
posts:11
votes: 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.
12:11 pm on May 11, 2008 (gmt 0)

Administrator

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

joined:July 24, 2001
posts:15755
votes: 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

12:09 am on May 12, 2008 (gmt 0)

New User

5+ Year Member

joined:May 10, 2008
posts:11
votes: 0


I have changed the slash as suggested and now the web page is completely blank now...I'm stuck
3:02 pm on May 12, 2008 (gmt 0)

Administrator

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

joined:July 24, 2001
posts:15755
votes: 0


have you viewed the source of that page?

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

3:21 pm on May 12, 2008 (gmt 0)

New User

5+ Year Member

joined:May 10, 2008
posts:11
votes: 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.

3:27 pm on May 12, 2008 (gmt 0)

Administrator

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

joined:July 24, 2001
posts:15755
votes: 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

3:35 pm on May 12, 2008 (gmt 0)

New User

5+ Year Member

joined:May 10, 2008
posts:11
votes: 0


How do you validate a page?
3:36 pm on May 12, 2008 (gmt 0)

Administrator

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

joined:July 24, 2001
posts:15755
votes: 0


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

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

3:43 pm on May 12, 2008 (gmt 0)

New User

5+ Year Member

joined:May 10, 2008
posts:11
votes: 0


Thank you