> -----Original Message----- > From: Kevin Stone [mailto:kevin@;helpelf.com] > Sent: 06 November 2002 18:50 > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Code Advice > > > All I have to go by is what I see. The method was this.. > > <? > $get_allow = array('foo', 'bar', 'add', 'takeovertheworld'); > > while (list($key,$val)=each($get_allow)) > { > if (isset($_GET[$key])) > $$key = $val; > } > ?> > > The array $get_allow has numerical indicies. Looping through > that in the > method described is going to set an integer to $key. So your > first error is > going to be that $_GET[0] is Undefined. Second error is > going to be $$key > is an invalid variable name.
Mea culpa -- you're quite right, and I should read more carefully! (Well, it is 7pm and going home time....) This should, of course, be done like this: $get_allow = array(......); foreach ($get_allow as $key): if (isset($_GET($key)): $$key = $_GET[$key]; endif; endforeach; Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php