Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
xml data gets overwritten
#1
Hello,

So far I've created my own very simple plugin. It has got a form to fill in a title or in this case a category and an overview of all titles.

After submitting the title with my form the data gets saved to my xml-file. So far thats fine, but when I try to add another new entry the previous data gets overwritten.

I added following function to my plugin class called 'helloworld' Big Grin 


PHP Code:
public function processData($edit=null){

$xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><channel></channel>');

if(isset(
$_POST['new_category']))
{
$c_child $xml->addChild('category');
$c_child->addAttribute('name'$_POST['title']);
}
if(
XMLsave($xmlHelloWorldFile))

{
echo 
'<div class="updated">Updated!</div>';


How can I 'add' new data to the existing xml-data?

Thanks

teazmo
Reply


Messages In This Thread
xml data gets overwritten - by teazmo - 2016-09-23, 01:49:45
RE: xml data gets overwritten - by jlyon1515 - 2016-09-23, 02:31:37
RE: xml data gets overwritten - by shawn_a - 2016-09-23, 02:34:04



Users browsing this thread: 1 Guest(s)