variable in src

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

holisticsam
New php-forum User
New php-forum User
Posts: 4
Joined: Wed Apr 24, 2013 10:55 am

variable in src

Postby holisticsam » Wed Apr 24, 2013 11:29 am

I'm using the variable $product_image in this html code. I'm not sure why it's not displaying the image. When I echo the variable, I get the value gano_logo_1.jpg. When I type in gano_logo_1.jpg in the html code, it displays properly. When I check the source code of the page after it's run the src='' is blank.

<img border='0' src='$product_image' alt='$title' width='175' height='116'></td>
<td width='62%'>

johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: variable in src

Postby johnj » Wed Apr 24, 2013 7:40 pm

Please change this line
<img border='0' src='$product_image' alt='$title' width='175' height='116'></td>
<td width='62%'>

To

<img border='0' src='<?php echo $product_image; ?>' alt='<?php echo $title; ?>' width='175' height='116'></td>
<td width='62%'>


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 2 guests

cron