note 96164 deleted from function.nl2br by danbrown

From: Date: Thu, 11 Feb 2010 19:41:48 +0000
Subject: note 96164 deleted from function.nl2br by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-165887@lists.php.net to get a copy of this message
Note Submitter: Joe Tester ---- A cluge hack for mysql_real_escape_string: If you have post data with /r/n and use mysql_real_escape_string to clean it, then try to use any function on this page, the function will show the stripped version of the break tag (not the html). Hack: <code> $myVar = $_POST['myVar'];//e.g. //replace post string with pipes $myVar = str_replace("\r\n", "||", $myVar); //clean $myVar = mysql_real_escape_string($myVar); //replace pipes with real break tags $myVar = str_replace("||", "<br>", $myVar); </code> I'm sure there is a much smarter way to do this!

« previous php.notes (#165887) next »