RE: Problem with header in an if

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

 



[snip]
> 	/* send the errors to the interface and exit*/
> 	if('' !== $errorsReported){
> 		for($i = 0; $i < count($errorsReported); $i++){
> 			echo $errorsReported[$i];
> 		}
		unset($errorsReported);
		print_r($errorsReported);
> 	} else {
> 	/* reload the empty interface */


Well, the array still appears, it is empty  and unset (see modified code
above) does not get rid of it. Here is how it comes back ....
Array ( [0] => [1] => [2] => [3] => ) 
[/snip]

The $errorsReported array does not test as 'empty', it only has no
values. There are 4 keys set, so what I have to do is figure out how to
not set them.

/* check for errors */
$arrCheckItems = array(	
	'Name',
	'Dept',
	'Level',
);
/* check for blanks */
foreach($_POST AS $key=>$value){
	if(in_array(niceName($key), $arrCheckItems)){
	 	$errorsReported[] = notBlank($key, $value);
	} 
}

Even if the return from notBlank is nothing, $errorReported[] gets set
for each item passed in the foreach loop. I have tried using conditional
returns in the function, but to no avail. Perhaps my logic is screwed on
this.

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