Page 1 of 1

htmlspecialchars problem

Posted: Sat Jul 22, 2006 2:16 pm
by destiny_cores
I try this code

<?php
$new = htmlspecialchars("<a href='test'>Test</a>");
echo $new; // <a href='test'>Test</a>
?>
result should be in comment but my result is

<a href='test'>Test</a>

no change. what happen? Help me please....

thank you

Posted: Sat Jul 22, 2006 2:22 pm
by Benjamin
Are you wanting..

Code: Select all

htmlentities();

Posted: Sat Jul 22, 2006 2:41 pm
by John Cartwright
you are displaying the html entity and not parsing the html tag..


If you see <a href='test'>Test</a> as your output, go to view source and you'll see you actually are displaying the html entity, otherwise you'd simply see Test


fyi, htmlentities() is nearly identical to htmlspecialchars()