I'll skip the sql (figuring you'll have that covered)
while($rows = mysql_fetch_array($result))
{
$id = $rows['group_id'] ;
$name = $rows['group_name'];
echo "<input name=\"sel_group[]\" type=\"checkbox\"
value=\"$id\">$name<BR> >";
}
Bastien
From: "Jeff Broomall" <news@xxxxxxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Subject: Creating checkbox list.
Date: Tue, 21 Feb 2006 20:52:13 -0500
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
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php