Hi y'all, I have a php form that keeps track of my notes via MySQL. I decided to find a way to replace /n with <br /> and have tried the following 3 ways: $lng_desc=mysql_real_escape_string(nl2br($_POST['lng_desc'])); $lng_desc=mysql_real_escape_string(str_replace("\n","<br />",($_POST['lng_desc']))); $lng_desc=mysql_real_escape_string(preg_replace('/\n/','<br />',($_POST['lng_desc']))); All three ways do an excellent job of inserting the breaks. My only problem is that if I modify the same field, the breaks are reinserted (so 2 breaks per \n). If I modify again, I get even more breaks (even though I'm not adding any \n's - I can just resubmit without changing a thing and more show up). So, this means the \n's are not really being replaced. The \n's are found and a break added next to it. What am I doing wrong? Thanks as always. =) Rob
Try this. $replacearray = array("\r\n","\n\r","\n","\r"); $lng_desc=mysql_real_escape_string(str_replace($replacearray,"<br />",($_POST['lng_desc']))); PHP: