Display xml file cascaded contents in a drop down via php

125 Views Asked by At

I have a local xml file which I am trying to display over a webpage with following code.

All I get is a blank page.

<?php
   $xml_content = file_get_contents("C:\Users\user\Downloads\93D7.xml");
   $data = simplexml_load_string($xml_content);
   foreach ($data->item as $item) {
      var_dump($item->bookname);
   }
?>

Once the display works, I want to have a drop down where I will select the xml element / entity and it will display the value or child of that element / entity.

Can someone help?

I referred : Get multiple items from XML with SimpleXML & populating dropdown with values from xml file in php

Both individually gives me a blank page.

0

There are 0 best solutions below