Re: need for $_POST[''] changed after server upgrade

From: Date: Tue, 13 Dec 2005 05:26:27 +0000
Subject: Re: need for $_POST[''] changed after server upgrade
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-227362@lists.php.net to get a copy of this message
> On Dec 12, 2005, at 8:21 PM, Ray wrote: >> Hello, >> Thanks Matt, I appreciate your help. your solution is a lot easier >> than mine. >> It's also nice to understand what was happening. I was introduced to >> PHP >> after that type of globals were considered 'evil' so I hadn't seen code >> written that way. >> Ray >> -----Original Message----- >>> Register globals is no longer ON I believe. That is why it happened. >>> >>> To fix this: >>> >>> Foreach($_POST as $key => $value) ${$key} = $value; >>> >>> That will convert all of your post variables to local variables. > > Could not you also do: > > <?php > if (count($_REQUEST) > 0) { > while(list ($key, $val) = each ($_REQUEST)) { > $$key = $val; > } > } > ?> > The only problem I see with this is now you are asking php to issue a count on the $_REQUEST array, this could take some time depending on your form size.

« previous php.general (#227362) next »