I think the problem may be that when you are adding it to the database quotes are being slashed, or perhaps the html is interfering with the textarea open/close tags. I am not sure what the problem may be, but before I insert content into a database I use this function:
function text_make_html ($str,$nl=FALSE) {
$str=trim($str);
$str=stripslashes($str);
$str=htmlentities($str,ENT_NOQUOTES);
//if $nl then add in the line breaks auto
if ($nl) {
$str=nl2br($str);
$str=ereg_replace("\\n","",$str);
$str=ereg_replace("\\r","",$str);
$str=ereg_replace("<br />","<br>",$str);
}
$str = ereg_replace(" & ", " & ", $str);
$str=addslashes($str);
return $str;
}
I then use this function to extract it out into a textarea:
function text_make_textarea_compat ($str) {
$str=stripslashes($str);
$str=ereg_replace("<br />","\n",$str);
$str=ereg_replace("<br>","\n",$str);
return $str;
}
and this function to extract it out into a input box:
function text_make_form_compat ($str) {
$str=stripslashes($str);
$str=ereg_replace("\"",""",$str);
$str=ereg_replace("<br />","\n",$str);
$str=ereg_replace("<br>","\n",$str);
return $str;
}
Hope this helps,
Chris