So here is what I am working with, if anyone can provide any assistance I would be hugely appreciative.
First the basic xml...
<story>
<title>russ</title>
<para1>hereispara1</para1>
</story>
Now, I use this same xml structure for several things, news stories, calendar dates, etc. So I want to create a single php file that picks up variables from a form and replaces those in the existing PHP.
For example... if I had a form like <input type=text name=Title><input type=text name=para01>, i would like whatever came from this first variable that was submitted to the form (in this case "title"
to replace whatever is in the first node of the xml file... I dont want to match names of nodes though, I would highly prefer using something of an array,
maybe like $_POST[0] would somehow get into $storynode[0] which would mean that the new title would get inserted in the old title. This is how I have tried it so far, but when it gets to the dump_mem(); nothing has changed in the xml file, as if the set_content(); didnt work at all. Any ideas?
<?
$xmlDoc = domxml_open_file('whatever.xml');
$root = $xmlDoc->document_element();
$tobeupdated = $root->children();
for($a=0; $a<sizeof($tobeupdated); $a++)
{
$textnode = $tobeupdated[$a]->first_child();
$textnode->set_content($_POST[$a]);
}
echo $xmlDoc->dump_mem();
$xmlDoc->dump_file('whatever.xml', false, false);
?>
First the basic xml...
<story>
<title>russ</title>
<para1>hereispara1</para1>
</story>
Now, I use this same xml structure for several things, news stories, calendar dates, etc. So I want to create a single php file that picks up variables from a form and replaces those in the existing PHP.
For example... if I had a form like <input type=text name=Title><input type=text name=para01>, i would like whatever came from this first variable that was submitted to the form (in this case "title"

maybe like $_POST[0] would somehow get into $storynode[0] which would mean that the new title would get inserted in the old title. This is how I have tried it so far, but when it gets to the dump_mem(); nothing has changed in the xml file, as if the set_content(); didnt work at all. Any ideas?
<?
$xmlDoc = domxml_open_file('whatever.xml');
$root = $xmlDoc->document_element();
$tobeupdated = $root->children();
for($a=0; $a<sizeof($tobeupdated); $a++)
{
$textnode = $tobeupdated[$a]->first_child();
$textnode->set_content($_POST[$a]);
}
echo $xmlDoc->dump_mem();
$xmlDoc->dump_file('whatever.xml', false, false);
?>