I'm trying to echo a specific element's data from an XML file containing all the elements and their data. Here's my code:
$xml = simplexml_load_file("http://cslab.bc.edu/~cs254/data/periodic.xml");
$atom = $_GET['selectAtom'];
$symbol = $xml->$atom->SYMBOL;
echo $symbol;
The $atom variable returns the name of the atom after a user has submitted a form. I would like this php code to echo the symbol of the atom selected.