good morning,

i am making a simply guestbook using flash 5 as front-end and php/xml as the back-end.

I got it to work except when a users input contains special characters like alt+....
Then the php code (see below) generate a invalid xml file. How to solve this??????
PHP Code:

if ($command=="sign"){

/*check if the guestbook has been signed*/    
if ($naam!="" && $words!=""){

$existing_entries file('guest.xml','r');//read the file in array.

foreach($existing_entries as $entry)//check each element.
ereg('</guestbook>',$entry) )//if file has /guestbook dont read it unless keep reading in $new_entries.
$new_entries[] = $entry;
//$new_entries has all the contents of old file except </guestbook> .
//so now write in new entries
$new_entries[] ="\t<message>\n"

$new_entries[]="\t</guestbook>\n";  //add /guestbook tag.

$data join("",$new_entries);//join all the lines by nothing. \n are already there.

$fp fopen('guest.xml','w');//open guest.xml file,
fwrite($fp,$data);//write in data.
fclose($fp);//close the handle.

Thx in advance
(with special thx to jdk)