Posted by tg-php on 10/01/70 11:05
Sounds like $_GET isn't populated or has been over-written. Try doing the classic print_r on $_GET to see what it contains before you do the foreach.
If you are using a form (rather than an a_href link) to pass the GET data and you're using all checkboxes or something else that returns nothing or doesn't set the GET variables, you might see if that's the problem.
But yeah, print out the $_GET data right before the foreach and see what's in it. I'm guessing it doesn't contain an array because either no data was passed to the query string (is the PHP script in a frame and the parent frameset is receiving the GET data or something?) or it's been overwritten earlier in the script.
I try to make it a practice never (rarely at least) to do a $_POST['something'] = "somevalue" or $_GET['something'] = "somevalue". I like to consider those 'sacred' variables that are only set by a POST or GET form action (or an a_href tag in some cases of GET data). Once you start manipulating them in your code to 'fix' or 'adjust' them, then you run into issues where you may have overwritten your originally submitted data and you can get this kind of confusion.
Let us know what you find out.
-TG
= = = Original message = = =
Hello all;
I have encountered a very strange error on one of our customers sites.
Their script returns the following error:
Warning:Invalid argument supplied for foreach
This is in response to the following line:
foreach ($_GET as $key => $value)
All I am trying to do is parse the querystring!
Any ideas?
Thanks;
Brad
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
[Back to original message]
|