function createXMLFile() { if (isset($_POST['create_xml'])) { echo "Links Data Posted"; $xml_document = writeXMLString($fields); $path_dir = "xmlf/"; $path_dir .= 'filename' . ".xml"; /* Data in Variables ready to be written to an XML file */ $fp = fopen($path_dir, 'w'); $write = fwrite($fp, $xml_document); /* Loading the created XML file to check contents */ $sites = simplexml_load_file($path_dir); echo "<br> Checking the loaded file <br>" . $path_dir . "<br>"; echo "<br><br>Whats inside loaded XML file?<br>"; print_r($sites); } }
function createXMLFile($fields) { echo "Saves XML..."; $xml_document = writeXMLString($fields); $path_dir = "xmlf/"; $path_dir .= $_POST['archiveInformationPackageID'] . ".xml"; if (file_exists($path_dir)) { unlink($path_dir); } /* Data in Variables ready to be written to an XML file */ $fp = fopen($path_dir, 'w'); $write = fwrite($fp, $xml_document); /* Loading the created XML file to check contents */ $sites = simplexml_load_file($path_dir); echo "<br> Checking the loaded file <br>" . $path_dir . "<br>"; echo "<br><br>Whats inside loaded XML file?<br>"; print_r($sites); }