RE: [PHP-DB] Creating checkbox list.

From: Date: Wed, 22 Feb 2006 02:47:56 +0000
Subject: RE: [PHP-DB] Creating checkbox list.
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-41307@lists.php.net to get a copy of this message
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@broomall.us> To: <php-db@lists.php.net> Subject: [PHP-DB] 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


« previous php.db (#41307) next »