finding if $key has value
| From: | Peter J. Pieczora | Date: | Sat, 20 Jul 2002 20:55:00 +0000 |
| Subject: | finding if $key has value | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-108676@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.
while (list($k, $v) = each($data))
{
for ($i=0; $i<count($k); $i++) {
if (substr ($k[$i], 0, 1) == 'a') {
if ($k == !$v) { // <-- ????
$sectionA_error = 1;
} else {
$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.
cheers,
Peter