I created this PHP script that loads the contents of an XML file into a form, but I can't save it after modifying the fields.
I wanted to know if it was possible to do it, and how.
Thanks Mau.
<form name="form" method="post" action="">
<?php
if (file_exists('data/mess.xml')) {
$xml = simplexml_load_file('indexdata/index_messages_en.xml');
foreach ($xml->data as $el) {
echo "<label for='{$el}'>{$el['name']}</label>
<input name='{$el['name']}' value='{$el}'/><br>";
}
} else {
exit('Failed to open');
}
?>
<input type="submit" name="submit" id="submit" value="Update">
</form>
<?php
if (isset($_POST['submit'])) {
// method for save edited field in same xml file
}
?>
My mess.xml file:
<?xmlversion = "1.0"encoding = "UTF-8"?>
<project>
<data name="project_title">
<![CDATA[New Project]]></data>
<data name="section_title">
<![CDATA[ES000021903]]></data>
</project>