note 27650 deleted from function.each by didou

From: Date: Mon, 18 Aug 2003 15:59:53 +0000
Subject: note 27650 deleted from function.each by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-54592@lists.php.net to get a copy of this message
Note Submitter: daevid@daevid.com ---- [Editor's note: A much simpler one-line solution would be to either a) turn register_globals on in php.ini, or b) use extract($_POST)] This is almost stating the obvious, but especially for new users or those migrating to the newer PHP versions where register_globals is defaulted to OFF now. Simply put this at the top of all pages that require form data input and you won't have to go recode everything by prefixing the $_POST in front of it. reset ($_POST); while (list ($key, $val) = each ($_POST)) { //echo "$key => $val<br>\n"; $$key = $val; } basically it's mapping all the $_POST keys to a variable of their same name and then assigning the $_POST value to the new variable we just created.

« previous php.notes (#54592) next »