Cojawfee Posted March 4, 2006 Share Posted March 4, 2006 I'm currently in the process of refining a comment system I wrote, and I am including autoformatting and a BBcode like system.The only problem I am having is with preserving user created carriage returns. If you look at the source for this page and search for "The only problem" you will see that there are two "<br />" tags bewteen it and the previous paragraph. I was thinking about using str_replace() for this, but can you use the escape character for a carriage return to search for a carriage return that doesn't use the escape?If you are confused by the previous sentence, let me clear it up. When someone press enter twice (to create a new paragraph) I want to replace that with two "<br>" tags when it is displayed.There is obviously a way to do this, I would just like to know how. Link to comment https://forums.phpfreaks.com/topic/4104-finding-a-a-carriage-return-in-user-entered-text/ Share on other sites More sharing options...
kenrbnsn Posted March 4, 2006 Share Posted March 4, 2006 Look at the function [a href=\"http://www.php.net/nl2br\" target=\"_blank\"]nl2br[/a](). This function will add a '<br />' before each "\n" in the text. Use it when you send the text to the screen.Ken Link to comment https://forums.phpfreaks.com/topic/4104-finding-a-a-carriage-return-in-user-entered-text/#findComment-14276 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.