I have an HTML tag <img>
for specific products, however some products don't have images since their similar products already have the same. I want the viewer who reached these image-less products to be able to click on a link and get to the similar products. Now the <img>
is like this:
<img src="../imgs/product/<?php echo $productName;?>.png" alt="No image for this item. Please refer to its similar item: <?php echo $alt; ?> "/>
Then I want the $alt part to be a link to the similar product, so I wrote:
<?php
$alt = '<a href=\"singleproduct.php?singleItem='
. $similarProduct .'\">'. $similarProduct. '</a>';
?>
It's not possible to print out the link no matter how I revise the style of quotes. Just wondering if it's not possible at all to insert an <a>
inside of <img>
...? If not, how to make this work?