I have a problem. I have 2 files. First file data.php:
<?php
$str = '<?xml version="1.0"?>
<products>
<product>
<name>Radio</name>
<price>79.99</price>
<desc>Place for describe</desc>
</product>
<product>
<name>TV</name>
<price>599.99</price>
<desc>Place for describe</desc>
</product>
<product>
<name>Book</name>
<price>75.00</price>
<desc>Place for describe</desc>
</product>
<products>';
?>
And the second file index.php:
<?php
include('data.php');
$products =new SimpleXMLElement($str);
foreach($products->product as $product){
echo $product->name;
echo "<br>";
}
?>
I use Wamserver. When i try to run index.php in web Browser I get errors: http://zapodaj.net/images/fbd51b9ca6da9.jpg I want to show name of each product. Can someone can tell me how to solve this problem?