Re: POST Arrays with register globals..
| From: | Mark Heintz PHP Mailing Lists | Date: | Wed, 12 Jun 2002 20:12:14 +0000 |
| Subject: | Re: POST Arrays with register globals.. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-101805@lists.php.net to get a copy of this message | ||
$groups = $_POST['groups'];
or
if(isset($_POST['groups']) && is_array($_POST['groups']))
$groups = $_POST['groups'];
else
$groups = array();
so that groups is an (empty) array even if no checkboxes were checked
mh.
On Wed, 12 Jun 2002, Adam Plocher wrote:
> <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
>