NYCPHP Meetup

NYPHP.org

[nycphp-talk] Simple htmlspecialchars - stripslashes problem that I can't fix

Chris Shiflett shiflett at php.net
Thu Jul 31 17:58:59 EDT 2003


--- Phil Powell <soazine at erols.com> wrote:
> What combo of stripslashes() and htmlspecialchars() do I use
> to ensure I get a single-line entity from an HTML textarea

I think something like this will work, assuming $textarea is set to the
original value sent from the client:

if (get_magic_quotes_gpc())
{
     $textarea = stripslashes($textarea);
}
$textarea = htmlspecialchars($textarea);

Hope that helps.

Chris

=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/



More information about the talk mailing list