kevinkorb Posted January 18, 2007 Share Posted January 18, 2007 When I post a string from a textbox, I then clean it for mysql...When I output the string to an update textarea, it actually comes out \r\n instead of the line breaks.i.e.$_POST['myTextArea'];$clean = mysqli_real_escape_string($_POST['myTextArea']);mysqli_query("INSERT INTO myTable (myVal) VALUES ('$clean');");When getting the data back outSay I entered in..test1test2test3my textbox populatestest1\r\ntest2\r\ntest3\r\nwhen I do a stripslashes on it it outputstest1rntest2rntest3rnHow do I get the database to recognize the breaks and not literal text? Or how do I get the data out as planned?Thanks. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 19, 2007 Share Posted January 19, 2007 don't do stripslashes, use nl2br and then stripslashes. Quote Link to comment Share on other sites More sharing options...
kevinkorb Posted January 19, 2007 Author Share Posted January 19, 2007 I'm trying to output it back into a textarea to look exactly like it did originally... With the nl2br it will betest1<br>test2<br>test3 Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted January 20, 2007 Share Posted January 20, 2007 mysqli_real_escape_string shouldn't effect it, as \r and \n are invisible characters. Somewhere in your script it is causing this. What happens when you run nl2br on the string does it convert the \r\n in to a HTML line break ([nobbc]<br />[/nobbc])? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.