I am trying to print out the xml child "pizza" on a php page. Though it is not working, here is my code for parsing the xml file.
<?
$dom = simplexml_load_file("menu.xml");
foreach ($dom->menu->categories->pizzas->pizza as $pizza)
{
echo $pizza;
}
?>
This is the xml file
<menu>
<categories>
<pizzas>
<pizza>Cheese Pizza</pizza>
<pizza>Beef PIzza</pizza>
<pizza>Chickens Wings Pizza</pizza>
</pizzas>
</categories>
</menu>
I would just like to print out the different kinds of pizzas on my php page. I would like to display a menu on the page.
I get an error of "Trying to get property of non-object in /Applications/XAMPP/xamppfiles/htdocs/home.php on line 15"
Please Help! Thanks