It is doing that ;)
If you look at the source, you will see the expected output.
On Nov 17, 2007, at 4:41 AM, Ronald Wiplinger <ronald@xxxxxxxxx> wrote:
I tried to understand htmlentities by putting this code into a
test.php:
<?php
if(!$page) {
?>
<H3>Test of evil input</H3>
<form method="post" action="<?php echo $PHP_SELF?>">
<INPUT type="text" name="field1" size="100" maxlength="100">
<INPUT type="hidden" name="page" value="1">
<INPUT type="submit" name="submit" value="Check it!">
</form>
<?php
}
else
{
echo "field1=$field1<br>";
$field2=htmlentities($field1,ENT_QUOTES,UTF-8);
echo "field2=$field2<p>";
echo htmlentities($field1,ENT_QUOTES,UTF-8);
echo "<p>";
$str = "A 'quote' is <b>bold</b>";
// Outputs: A 'quote' is <b>bold</b>
echo htmlentities($str);
echo "<br>";
// Outputs: A 'quote' is <b>bold</b>
echo htmlentities($str, ENT_QUOTES);
}
?>
The output on the screen is:
field1=*Greater input and lower input*
field2=<b>Greater input and lower input</b>
<b>Greater input and lower input</b>
A 'quote' is <b>bold</b>
A 'quote' is <b>bold</b>
I expected that it would give me in the second line:
field2=<b>Greater input and lower input</b>
and the lower two lines I expected as:
A 'quote' is <b>bold</b>
A 'quote' is <b>bold</b>
What do I miss understand here?
bye
Ronald
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php