>From a <textarea> on a web form I'm attempting to convert all returns(\r), from the users input, to "<br />", for db INSERT, and then back again for display in the <textarea>. (They remain as <br />s for normal HTML web page display.) code: // From textarea to db UPDATE function addBR($tv) { $tv = addslashes($tv); $tv = str_replace("\r","<br />",$tv); // $tv = preg_replace("/(\r\n|\n|\r)/", "<br />", $tv); // $tv = preg_replace("/(\r\n|\n|\r)/", "", $tv); return $tv;} // For display in <textarea> function remBR($tv) { $tv = str_replace("<br />","\r",$tv); $tv = stripslashes($tv); return $tv; } IT ALL works fine accept if a return is entered in the form's <textarea> at the very beginning: mysql> SELECT jbs_jobDesA FROM jobs WHERE jbs_ID=77 \G *************************** 1. row *************************** jbs_jobDesA: <br />[the return is still here] Lesequam coreet la feum nulla feu facil iriure faccummolut ulput num augait 1 row in set (0.00 sec) the return is converted to <br />\r (leaving the return). AND then when converted back for for the <textarea> both are stripped out, that is, there is nothing in front of the first character. When resubmitted for UPDATE: mysql> SELECT jbs_jobDesA FROM jobs WHERE jbs_ID=77 \G *************************** 1. row *************************** jbs_jobDesA: Lesequam coreet la feum nulla feu facil iriure faccummolut ulput num augait 1 row in set (0.00 sec) Q. Why is that first return treated differently? All other returns are treated as expected. Thanks, sam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php