In the following php code , I am trying to echo the values of $title and $desc but it doesnot show values just showing variable names. Any help will be appreciated.
foreach ($prod as $product) {
$title=$product['title'];
$desc=$product['desc'];
echo '
<div class="detail">
<div class="img"><img src="images/pro1.png"/></div>
<div class="textdetail"><p><b>$title</b><br /></p>
<p><a href="#">$desc</a></p>
</div><br />
</div>';
}
You’ll have to use double quotes, or take them outside the string – I personally always prefer the latter method, for clarity reasons. Either works.
This should do it: