Re: finding if $key has value
| From: | Richard Lynch | Date: | Sun, 21 Jul 2002 05:22:27 +0000 |
| Subject: | Re: finding if $key has value | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-108702@lists.php.net to get a copy of this message | ||
>here is what i try to accpmplish:
>$key "name's" in an array are: a1, a2, a3, .... .
>$value dependes weather it has been checked, selected or entered.
# First, assume they screwed up until they prove otherwise:
$sectionA_error = 1;
>while (list($k, $v) = each($data))
> {
> for ($i=0; $i<count($k); $i++) {
# Here, they prove that they did not screw up:
> if (substr ($k[$i], 0, 1) == 'a') {
# Just take this part out.
#> if ($k == !$v) { // <-- ????
#> $sectionA_error = 1;
#> } else {
# Since they did not screw up, set the 'error' flag to 0:
> $sectionA_error = 0;
> }
> }
> }
>}
>if ($sectionA_error) {
> echo "Nothing entered.\n<br>";
> } else {
> echo "at least one entry.\n<br>";
> }
>
>what i'm trying to get is:
>if there is a least one or doesn't matter how many values error = 0,
>if there is no value than error =1.
--
Like Music? http://l-i-e.com/artists.htm