Creating checkbox list.
| From: | Jeff Broomall | Date: | Wed, 22 Feb 2006 01:52:13 +0000 |
| Subject: | Creating checkbox list. | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-41306@lists.php.net to get a copy of this message | ||
Good evening.
I'm sure this is something easy so I'm hoping you can simply steer me to a good source.
I simply need to create a Checkbox list using data from my "groups" table.
I have a table with two fields:
1) groups_id
2) groups_name
The data contained is simple:
groups_id groups_name
----------- ----------------
1 Group A
2 Group B
3 Group C
4 Group D
I would like to dynamically create a checkbox selection similar to:
<input name="sel_group[]" type="checkbox" value="1">Group A<BR>
<input name="sel_group[]" type="checkbox" value="2">Group B<BR>
<input name="sel_group[]" type="checkbox" value="3">Group C<BR>
<input name="sel_group[]" type="checkbox" value="4">Group D<BR>
So I need a script that'll take this information from the groups table
and create the above. Can you help?
As I look at this, I believe I'm going to need to create an array for my final "report." So I just added the [] after sel_group.
Thanks.
Ward