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:
<?PHP

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.
        
{
                if(! 
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\t<naam>".$naam."</naam>\n"
$new_entries[]="\t\t<email>".$email."</email>\n"
$new_entries[]="\t\t<words>".$words."</words>\n"
$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.
}
    echo(
"done=1");
}

?>
Thx in advance
D-flyer
(with special thx to jdk)