writing to an XML with PHP
Posted: Wed Sep 11, 2002 8:56 am
hi,
I am new to php and although php has xml support i am not using it cause i am not too familiar with it
i created a simple php script that writes information from a form to an xml file using fwrite()
the outputstring is as follows
---file--
<?xml version="1.0" encoding="iso-8859-1"?>
<guestbook>
</guestbook>
--endfile--
---code----
$data = "<guest date=\"date('jS F Y')\">\n"."<name>\n".$_POST[Name]."</name>\n"."<email>\n".$_POST[Email]."</email>\n"."<comments>\n".$_POST[Comments]."</comments>\n"."</guest>\n"."</guestbook>";
$file = str_replace("</guestbook>",$data,$file);
---end ----
then i write the file
however in tryin to view the xml file i get nuthing and viewing the source code reveals html content
can i just write to the xml file withou any php/cml functions?
I am new to php and although php has xml support i am not using it cause i am not too familiar with it
i created a simple php script that writes information from a form to an xml file using fwrite()
the outputstring is as follows
---file--
<?xml version="1.0" encoding="iso-8859-1"?>
<guestbook>
</guestbook>
--endfile--
---code----
$data = "<guest date=\"date('jS F Y')\">\n"."<name>\n".$_POST[Name]."</name>\n"."<email>\n".$_POST[Email]."</email>\n"."<comments>\n".$_POST[Comments]."</comments>\n"."</guest>\n"."</guestbook>";
$file = str_replace("</guestbook>",$data,$file);
---end ----
then i write the file
however in tryin to view the xml file i get nuthing and viewing the source code reveals html content
can i just write to the xml file withou any php/cml functions?