I have this simplexml script that I use to send data entered from a form.
$xml = simplexml_load_file("links.xml");
$sxe = new SimpleXMLElement($xml->asXML());
$person = $sxe->addChild("link");
$person->addChild("title", "Q: ".$x_title);
$person->addChild("url", "questions_layout.php#Question$id");
$sxe->asXML("links.xml");
and when it appears, it looks like this on one line:
<link><title>Alabama State</title><url>questions_layout.php#Question37</url></link><link><title>Michigan State</title><url>questions_layout.php#Question37</url></link></pages>
But I tried the method found HERE and THIS IS GOOD , but do not format the XML correctly in strings, as they should look like
<link>
<title></title>
<url></url>
</link>
In the first link, I even changed loadXMLto loadbecause it loadXMLexpects a string as XML. Can someone help me find a solution to this?
Tower source
share