A php-mysql checkbox question

From: Date: Fri, 04 Jul 2003 22:44:48 +0000
Subject: A php-mysql checkbox question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-154031@lists.php.net to get a copy of this message
Hello, I have a problem trying to show a checkbox list and have some of the boxes checked and not others. Here are the details: table: features rec_id | fName -----------------
1       |  Window
-----------------
2       |  pool
-----------------
3       | fence
-----------------
4       | Drive
table: com_features rec_id | com_features_id | feature_id ------------------------------------------
1       |  2                |  1
------------------------------------------
2       |  1                |  4
------------------------------------------
3       |  1                |  3
------------------------------------------
4       |  2                |  3
------------------------------------------
5       |  4                |  4
------------------------------------------
6       |  7                |  4
------------------------------------------
7       |  8                |  4
------------------------------------------
8       |  2                |  4
what I want is to display a checkbox list that would show all the values from 'features' and have the appropriate boxes checked when 'com_features.com_features.id = 2' ie X Window pool X fence X drive The query I am using now is: $sql ="SELECT features.rec_id AS rec_id, features.fName AS fName, com_features.feature_id AS feature_id, com_features.com_rec_id AS com_rec_id FROM features, com_features WHERE com_features.com_rec_id = \"2\" AND features.TheTest=\"1\""; What I get in the return is: X Window pool fence drive Window pool X fence drive Window pool fence X drive TIA for any help, John -- =========================== John T. Beresford, Owner Digital Studio Design Edmond, OK http://www.digitalstudiodesign.com/ 405.760.0794

« previous php.general (#154031) next »