OK- I have a form that has a bunch of text boxes named like "inst[cym]" which makes them all in to a big array with keys like "cym" and values as the values in the text box - right?
now, I POST that to the next page and I use a little script like this:
while (list($key, $val) = each($HTTP_POST_VARS)) {
if (!is_array($val)) { //if variable is not an array//
echo "$key => $val<BR>\n";
} else {
echo $key;
print_r($val); echo "<BR>\n";
}
}
(which is a great little script BTW for dumping all your post data to the screen). It correctly dumps the array to the screen as an array (i.e. it says: "instArray ( [cym] => 4" etc). This tells me that PHP believes that $instArray is and aray.
Now later, I want to use a while loop to go through each value of the array and do some other stuff, so I do:
while (list($key, $val) = each($instArray)) {
and I get an error saying:
Warning: Variable passed to each() is not an array or object
anyone know why this is so?
BTW - tried to use settype, I also tried resetting the array, but since it doesn't think its an array that didn't work.... I'm obviously missing something here.