On Fri, Mar 11, 2011 at 13:07, Lisa Nguyen <lisa.ngu...@jpl.nasa.gov> wrote:
> Hi
>
> I use one of your example to test the htmlspecialchars :
>
> <?php
> $new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES);
> echo $new; // &lt;a href=&#039;test&#039;&gt;Test&lt;/a&gt;
> ?>
>
> On my browse, it display like below
> <a href='test'>Test</a>
>
> Instead:
> Test
>
> Please help me how display on browse only "Test", not like view source.

    First, this isn't a support channel.  Please view
http://php.net/support for a brief list of available support methods.
The list you want is PHP General (CC'd on this email, and you can
subscribe at http://php.net/mailinglists ).

    Second, you're using htmlspecialchars(), which is converting the <
and > to &lt; and &gt; respectively, which will cause the browser to
display it as if it was source (though viewing the source of that
would show you the entities).

    Instead, check out strip_tags(), which is likely what you want:

        http://php.net/strip_tags

-- 
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to