note 33370 modified in function.htmlentities by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 17:11:30 +0000 |
| Subject: | note 33370 modified in function.htmlentities by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154954@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   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;
}
?>
--was--
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:
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;
}
http://php.net/manual/en/function.htmlentities.php