A web development dummy here :) How do I put a php variable inside an html tag? for example, here I want to print each product's name, price, and image (also could you please suggest whether the way I retrieve the image is correct?)
<?php
$doc = new DOMDocument();
$doc->load('database/products.xml');
$products = $doc->getElementsByTagName("fruit");
foreach ($products as $fruit) {
$names = $fruit->getElementsByTagName("name");
$name = $names->item(0)->nodeValue;
$prices = $fruit->getElementsByTagName("price");
$price = $prices->item(0)->nodeValue;
$images = $fruit->getElementsByTagName("image");
$image = $images->item(0)->nodeValue;
echo "<b>$name - $price - $image\n</b><br>";
echo'
<div class="container">
<a href="p3Apples.html">
<img src="img/'.$image.'" class="item-image">
<div class=‘iamge-title’>$name</div>
<div class=‘item-price’> $.$price </div>
<a href=‘shoppingcart.html’ class=‘b-menu’>
<img id=‘test’ src=‘img/addToCart.png’> </a>
</form>
</a>
</div>
';
};
?>