note 33370 rejected from function.htmlentities by hholzgra
| From: | hholzgra@php.net | Date: | Thu, 02 Aug 2012 11:21:14 +0000 |
| Subject: | note 33370 rejected from function.htmlentities by hholzgra | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189581@lists.php.net to get a copy of this message | ||
Note Submitter: Anthony Aragues
----
I found in a previous not the function for encoding the input... which worked great, but it also
encoded the   and <br> that was being automatically added in my POST, so I created and
Output function to go with it that worked for me:
<?php
function VerbatimInput($String)
{
$Output = mysql_escape_string(htmlentities(addslashes($String)));
return $Output;
}
function VerbatimOutput($Input)
{
$Output = str_replace("<br />", "<br>",
"$Input");
$Output = str_replace("&nbsp;", " ", "$Output");
return $Output;
}
?>