adam84 Posted September 2, 2008 Share Posted September 2, 2008 If I type in a b c d in my text area (each letter is on a new line, new line = enter) When I process the data using php, I want to change all the '\n' to <br />. For some reason it is not working correct. I've tried two different approaches approach 1 $text = nl2br($text); approach 2 $newLine = array( '\r\n', '\n', '\r' ); $text = str_replace( $newLine, "<br />", $text); Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted September 2, 2008 Share Posted September 2, 2008 $text = $_POST['textarea']; $text = nl2br($text); 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.