note 33968 added to language.variables.external

From: Date: Sat, 12 Jul 2003 08:04:02 +0000
Subject: note 33968 added to language.variables.external
Groups: php.notes 
Request: Send a blank email to php-notes+get-51957@lists.php.net to get a copy of this message
I've combined the method of converting old code suggested by solar at heliacal dot net into the improved script below. This one works whether the submit is get or post and, as in my previous contribution, sets any unsubmitted variables to null, preventing errors. This supercedes my previous post below (if it hasn't been deleted yet). $expected=array( 'name', // Only accept these variables from a submit! 'email', 'favorite_color' ); foreach ($expected as $formvar) $$formvar = (isset(${"_$_SERVER[REQUEST_METHOD]"}[$formvar]))? ${"_$_SERVER[REQUEST_METHOD]"}[$formvar]:NULL; ---- Manual Page -- http://www.php.net/manual/en/language.variables.external.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33968 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33968&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33968&report=yes

« previous php.notes (#51957) next »