This code works, but it only replaces the XML already written with new XML, I dont want to replace old XML, I want to add new. Anyone know how I might create new xml, rather than replace?
I have this code:
<?php
// set name of XML file
$file = "usethis.xml";
// load file
$xml = simplexml_load_file($file) or die ("Unable to load XML file!");
// modify XML data
$xml->parent->name = $_POST['name'];
$xml->parent->words = $_POST['words'];
// write new data to file
file_put_contents($file, $xml->asXML());
include("usethis.xml");
?>