Hi there
I have dynamic checkboxes with values populated from a database table and want to set the boxes to selected based on values from another table.
Basically, I have a table of users, a table of categories (populates the checkbox values) and a table that is populated when multiple categories are selected per user (the table used to set the checkboxes to selected)…hope this is clear…Its for an ‘Edit user’ page, displaying the info for the user.
Is this possible?
This what I currently have:
<?php do { ?><input <?php if (!(strcmp($row_userCats['dlcatID'],$row_engineerCat['dlCatID'] ))) {echo "checked="checked"";} ?> type=“checkbox” name=“checkbox[]” value="<?php echo $row_engineerCat['dlCatID']; ?>" />
<span class="formLBL"><?php echo $row_engineerCat['dlCat']; ?></span>
</label>
<?php } while ($row_engineerCat = mysql_fetch_assoc($engineerCat)); ?>
(yes it is doctored dreamweaver code )
But this only selects the first returned value from the userCats recordset.
Any help would be greatly appreciated.
Mitch