Re: Re: error checking a null array

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

 



AAarg.


Okay, thanks to all of you I've decided that any field name I need to see will be sent to $_SESSION['required_fields'] and basta.

Then after the submit button is pressed, I am doing this:



reset($_SESSION['required_fields']);
  foreach ($_SESSION['required_fields'] as $fieldname)
    {
       if (!isset($_POST[$fieldname]) || empty($_POST[$fieldname]))
        {
        $message[$fieldname]=1;
        include_once(QUESTIONS . 'q.inc');
        }
    }//error check



And this is *almost* working: it seems to crap out after the first loop through the $_SESSION['required_field'] array.

The array says:

Array ( [required_fields] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 1 [5] => 2 [6] => 3 [7] => 4 [8] => 1 [9] => 2 [10] => 3 [11] => 4 ) )

$_POST says:

Array ( [action] => [process]process [1] => [2] => 68 [3] => [4] => )

So you see, there's an answer specified for the value of question [2].

But $messages says only:

$message: array(1) { [1]=>  int(1) }


Why is it dying after the first loop through?

Thanks in advance

--
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