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); Link to comment https://forums.phpfreaks.com/topic/122403-textarea/ 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); Link to comment https://forums.phpfreaks.com/topic/122403-textarea/#findComment-632042 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.