<root>
<gallery name="First"/>
<gallery name="Second"/>
<gallery name="Third"/>
</root>
I think I have solved part of a previous problem and now have the foreach loop correct? Still I can't get it to save the xml.
$objXML = new SimpleXMLElement(XML_FILE_NAME, null, true);
foreach($objXML->xpath('/root/gallery/@name') as $key => $old){
$new = $_POST['name'][$key];
echo "$key : $old : $new<br />
";
$old = $new; // this does nothing??
}
$objXML->asXML(XML_FILE_NAME);
echo returns:
0 : First : First New
1 : Second : Second New
2 : Third : Third New
Why does this not save the new posted values for 'name' back to my XML doc, what am I doing wrong?