elkloso: XML generieren, nach ausfüllen eines Formulars

Beitrag lesen

hey danke.
Also muss ich statt addAtributes , addchild schreiben?

Mein code ist im moment dann

<?php  
$xml = simplexml_load_file("test.xml");  
$xml = new SimpleXMLElement("event");  
$start = $xml->addchild("start","$_POST[start]");  
$title = $xml->addchild("title","$_POST[title]");  
$handle = fopen("test.xml", "wb");  
fwrite($handle, $xml->asXML());  
fclose($handle);  
?>

Wenn ich nun die PHP aufrufe, kommt

[quote]
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 1: parser error : Start tag expected, '<' not found in /homepages/26/d284984573/htdocs/Geschichte/formular.php5 on line 3

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: event in /homepages/26/d284984573/htdocs/Geschichte/formular.php5 on line 3

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in /homepages/26/d284984573/htdocs/Geschichte/formular.php5 on line 3

Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /homepages/26/d284984573/htdocs/Geschichte/formular.php5:3 Stack trace: #0 /homepages/26/d284984573/htdocs/Geschichte/formular.php5(3): SimpleXMLElement->__construct('event') #1 {main} thrown in /homepages/26/d284984573/htdocs/Geschichte/formular.php5 on line 3
[/quote]