Re: More form questions
| From: | Kondwani Spike Mkandawire | Date: | Thu, 08 Aug 2002 18:32:14 +0000 |
| Subject: | Re: More form questions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-111711@lists.php.net to get a copy of this message | ||
"Ashley M. Kirchner" <ashley@pcraft.com> wrote in message
news:3D52B95D.CD7796E2@pcraft.com...
>
> One of the fields on a form I'm building consists of multiple
checkboxes.
> How can I check whether at least one is selected?
>
> The form looks like this:
>
> <td align="left">Permission to Post:<br>
> <blockquote>
> <input type="checkbox" name="Post1"<? echo (($Post1 == 1) ? "
> checked" :
"");
> ?>> Email Address<br>
> <input type="checkbox" name="Post2"<? echo (($Post2 == 1) ? "
> checked" :
"");
> ?>> Personal URL<br>
> <input type="checkbox" name="Post3"<? echo (($Post3 == 1) ? "
> checked" :
"");
> ?>> News About Me<br>
> <input type="checkbox" name="Post4"<? echo (($Post4 == 1) ? "
> checked" :
"");
> ?>> Photos<br>
> </blockquote>
> </td>
>
use the logic statements (if/else statements) like so...
if((empty($Post1)&&(empty($Post2))&&(empty($Post3))&&(empty($Post4)){
echo "None of the fields have been filled";
... Do whatever...
...
}
Spike...