unable to use vars in foreach
| From: | Jonathan Villa | Date: | Mon, 15 Nov 2004 02:27:30 +0000 |
| Subject: | unable to use vars in foreach | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-202003@lists.php.net to get a copy of this message | ||
I'm using PHP 5.0.2
Here is a snippet of my code
$post=$_POST;//this is actually happening in an include somewhere else and
autoprepended. Works just fine.
$modules = simplexml_load_file(MODULES);
foreach ($modules->module as $mod) {
echo $mod->postName.'<br>';
if (isset($post[$mod->postName])) {
die('in post');
....
.....
echo-ing the postName works just fine, but when I get to the checking
whether or not the val is set, I get the error:
Warning: Illegal offset type in unset in /var/www/.....
If I replace $post[$mod->postName] with a hardcoded val, it works
$post['news']
The values of $mod->postName are names of checkboxes.