NYCPHP Meetup

NYPHP.org

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

Phil Powell soazine at erols.com
Thu Jul 31 18:02:56 EDT 2003


Chris, this is what I have now:

echo "<input type=hidden name=$key value=\"";
    if (get_magic_quotes_gpc()) $val = stripslashes($val);
    $val = htmlspecialchars($val);
    echo "\">\n";

Based on your idea.  However, the results are still the same: I am still
getting improperly formatted values of $val inside <input..>

Phil
----- Original Message -----
From: "Chris Shiflett" <shiflett at php.net>
To: "NYPHP Talk" <talk at lists.nyphp.org>
Sent: Thursday, July 31, 2003 5:58 PM
Subject: Re: [nycphp-talk] Simple htmlspecialchars - stripslashes problem
thatI can't fix


> --- 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/
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk




More information about the talk mailing list