RE: [PHP] POST Arrays with register globals..
| From: | John Holmes | Date: | Thu, 13 Jun 2002 00:38:13 +0000 |
| Subject: | RE: [PHP] POST Arrays with register globals.. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-101850@lists.php.net to get a copy of this message | ||
$_POST['groups'] is an array. It's size is going to be dependant on how
many check boxes were checked.
So, in your example, if only blah2 is selected, you'll have
$_POST['groups'][0] == '2'
You can use count($_POST['groups']) to see how many boxes were checked.
---John Holmes...
> -----Original Message-----
> From: Adam Plocher [mailto:aplocher@erepublic.com]
> Sent: Wednesday, June 12, 2002 4:15 PM
> To: php-general@lists.php.net
> Subject: [PHP] POST Arrays with register globals..
>
> <input type="checkbox" name="groups[]" value="1"
> checked>
blah1<br>
> <input type="checkbox" name="groups[]" value="2"
> checked>&nbps;
blah2<br>
> <input type="checkbox" name="groups[]" value="3"
> checked>
blah3<br>
>
> I can't seem to access that data correctly when that form gets
submitted.
>
> I have tried:
>
> $groups[] = $_POST['groups[]'];
> and
> $groups[] = $_POST['groups'];
>
> no luck..
>
> Can somebody please give me a hand, thanks a lot.
>
> -Adam