[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

Reply via email to