Re: Re: Variable name as a string
| From: | Micah Gersten | Date: | Wed, 27 Aug 2008 22:34:14 +0000 |
| Subject: | Re: Re: Variable name as a string | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-278842@lists.php.net to get a copy of this message | ||
First, the type is checkbox, not check. Second, you cannot put a value
in the brackets for a checkbox group. A checkbox group is passed to
PHP automatically as an array.
Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com
Maciek Sokolewicz wrote:
> Well, this seems easier/cleaner to me:
>
> <input type="check" name="my_checkboxes[1]" value="1" />
> 1<br />
> <input type="check" name="my_checkboxes[2]" value="1" />
> 1<br />
> <input type="check" name="my_checkboxes[3]" value="1" />
> 1<br />
> <input type="check" name="my_checkboxes[4]" value="1" />
> 1<br />
>
> $my_checked_checkboxes = $_REQUEST['my_checkboxes']; // whichever
> you wish, $_GET or $_POST, I don't care right now; you choose.
>