Anyone familiar with simpleXML?

I’m trying to get my simpleXML to work but I think I must be going about it the wrong way. I’ve checked my version of PHP and its good. For some reason though the code seems to be breaking after the arrow operator, but only when I stick the code in an html form. In a .php form it works. Is there a way around this, and if so how do I share the info from the .php page with my html page?

Here is the relevant code:


<?

    $xml = simplexml_load_file('events.xml');
    
    echo $xml->getName() . "<br />";
    
    foreach($xml->children() as $child)
    {
    echo $child->getName() . ": " . $child . "<br />";
    }

?>