Re: Re: error checking a null array
| From: | Jack Jackson | Date: | Mon, 01 Aug 2005 19:43:22 +0000 |
| Subject: | Re: Re: error checking a null array | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-219786@lists.php.net to get a copy of this message | ||
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