I'm a novice to PHP. What I want to do is add a new customer record to my XML database. It looks as if a simple way to do this would be to create a string using heredoc, which will insert the variable values, then turn it into a simpleXML object:
$xml=simplexml_load_file("Test data.xml"); //load XML file
// these $vars are all defined from form input in previous code
$str= <<<EOS
<!---->
<customer>
<cId>$Customer</cId>
<organization>$organization</organization>
<website>$URL</website>
<contact>$name</contact>