unable to use vars in foreach

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux