Chuckster Posted July 19, 2010 Share Posted July 19, 2010 Randomly, out of no where, when people post things in the forum then leave a line, lots of little symbols are coming up like these \r\n\r\n How do i fix this??????? Quote Link to comment Share on other sites More sharing options...
mxyi Posted July 19, 2010 Share Posted July 19, 2010 i have the same error :P Quote Link to comment Share on other sites More sharing options...
Paddy Posted July 19, 2010 Share Posted July 19, 2010 a small example to get you to the right direction This function will change new lines (line breaks) to and it allows you to limit the amount of brs allowed at any point in time. This function was made to avoid people spaming a textarea with hundreds of line breaks or empty lines. function nl2br_limit($string, $num){ $dirty = preg_replace('/\r/', '', $string); $clean = preg_replace('/\n{4,}/', str_repeat(' ', $num), preg_replace('/\r/', '', $dirty)); return nl2br($clean); } echo nl2br_limit($string,'4'); // Heres how it works // nl2br_limit($string, $num) // $string is the entered text you want to strip lines out of, it could be ($_POST['myinput']) // $num is the amount of consecutive 's that are allowed any at a time. The user is allowed to enter as many line breaks as $num allows php.net or you can use -->> stripslashes($_REQUEST['post']) if im not mistaken 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.