RE: Problem with header in an if SOLVED

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

 



[snip]
/* 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.
[/snip]

I changed to  the following code and it solves the problem ...

foreach($_POST AS $key=>$value){
	if(in_array(niceName($key), $arrCheckItems)){
	 	$nbr = notBlank($key, $value);
		if(!('' == $nbr)){
			$errorsReported[] = $nbr;
		}
	} 
}

Before I was directly assigning the value of the return from the
notBlank function to $errorsReported. Now something only gets assigned
to $errorsReported if there is something to assign. 

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