note 14240 deleted from function.get-magic-quotes-gpc by aidan

From: Date: Tue, 06 Jul 2004 06:20:59 +0000
Subject: note 14240 deleted from function.get-magic-quotes-gpc by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-72707@lists.php.net to get a copy of this message
Note Submitter: ocrow@simplexity.net ---- A common need would be to post the results of a submitted form back into the contents of another HTML form. For example, if a data field failed to validate you might re-present the original form with the field data as entered and ask the user to make changes. How to do this, in an environment where magic_quotes_gpc may or may not be set? Using ini_set("magic_quotes_gpc",0) in the php script as previously suggested doesn't work, becuase by the time the ini_set is called, the get and post vars have already been parsed and quoted. My solution is this: <? function formvar ($name) { $var = $GLOBALS[$name]; if (get_magic_quotes_gpc()) $var = stripslashes($var); print htmlspecialchars($var); }; ?> <form> <input name="foo" value="<?formvar("foo")?>"> </form>

« previous php.notes (#72707) next »