NYCPHP Meetup

NYPHP.org

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

Chris Shiflett shiflett at php.net
Thu Jul 31 18:26:18 EDT 2003


--- Phil Powell <soazine at erols.com> wrote:
> echo "<input type=hidden name=$key value=\"";
>     if (get_magic_quotes_gpc()) $val = stripslashes($val);
>     $val = htmlspecialchars($val);
>     echo "\">\n";

OK, this can't be your code, unless I'm missing something. This doesn't output
anything for the value attribute of your input tag.

Try this:

$val is [<? echo $val; ?>]
<?
if (get_magic_quotes_gpc())
{
     $val = stripslashes($val);
}
$val = htmlspecialchars($val);
?>
<input type="hidden" name="<? echo $key; ?>" value="<? echo $val; ?>">

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