note 33370 added to function.htmlentities

From: Date: Tue, 24 Jun 2003 09:24:28 +0000
Subject: note 33370 added to function.htmlentities
Groups: php.notes 
Request: Send a blank email to php-notes+get-50918@lists.php.net to get a copy of this message
I found in a previous not the function for encoding the input... which worked great, but it also encoded the &nbsp and <br> that was being automatically added in my POST, so I created and Output function to go with it that worked for me: function VerbatimInput($String) { $Output = mysql_escape_string(htmlentities(addslashes($String))); return $Output; } function VerbatimOutput($Input) { $Output = str_replace("&lt;br /&gt;", "<br>", "$Input"); $Output = str_replace("&amp;nbsp;", "&nbsp", "$Output"); return $Output; } ---- Manual Page -- http://www.php.net/manual/en/function.htmlentities.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33370 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33370&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33370&report=yes

« previous php.notes (#50918) next »