SCS
SCS

Reputation: 1

PHP Concatenating of image link in echo

I want to echo the image such that the variables $CatSelected will be the folder of the images and $char and $i are part of the img names : e.g

echo "<img src =\"Images/product/".$CatSelected."/".$char$i."s0.jpg"\>";

Upvotes: 0

Views: 1538

Answers (2)

Deepak Mallah
Deepak Mallah

Reputation: 4076

try this

echo "<img src ='Images/product/'".$CatSelected."/".$char$i."'s0.jpg'\>";

Upvotes: 0

Yogesh Suthar
Yogesh Suthar

Reputation: 30488

 echo "<img src =\"Images/product/".$CatSelected."/".$char.$i."s0.jpg\"\>";
                                                          ^          ^

1) You forgot to concatenate $char and $i.

2) You forgot to escape the double quotes.

Upvotes: 2

Related Questions