Welcome to WebmasterWorld Guest from 54.221.87.97

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Image add to cart Button

     

Jaz950

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

5+ Year Member



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

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

WebmasterWorld Senior Member 10+ Year Member



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

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

5+ Year Member



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

wheelie34

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

WebmasterWorld Senior Member 10+ Year Member



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

Jaz950

12:06 am on May 11, 2008 (gmt 0)

5+ Year Member



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

7:56 am on May 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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

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

5+ Year Member



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

jatar_k

11:50 am on May 11, 2008 (gmt 0)

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



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

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

5+ Year Member



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

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

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



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

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

5+ Year Member



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

jatar_k

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

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



have you viewed the source of that page?

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

Jaz950

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

5+ Year Member



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

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

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



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

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

5+ Year Member



How do you validate a page?

jatar_k

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

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



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

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

Jaz950

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

5+ Year Member



Thank you
 

Featured Threads

Hot Threads This Week

Hot Threads This Month