Jump to content

Checkbox question - editing an existing selection


BarneyJoe

Recommended Posts

Hope someone can help with this.

I basically have a table 'Photos', table 'Keywords', and a table 'Photo_Keywords'. The idea is that users can add a selection of relevant keywords to a photo using a screen full of keywords by checking the appropriate boxes.

I'm having trouble on my edit keywords page tho' - I initially got it working, but without the existing keyword checkboxes being checked, and am now trying to get the keyword selection to persist when a user selects the edit keywords page from the photo detail page.

My recordset on the update keywords page is using table 'Photo_Keywords', and is filtering using the Photo_ID as URL parameter.

I then have the checkboxes as Dynamic and setting them to be checked should there be a match on Keyword_ID, like :

<input type='hidden' name='Photo_ID' value='<?php echo $Photo_ID; ?>'>

Ancient Monument<input <?php if (!(strcmp($row_Keyword_Match['Keyword_ID'],2))) {echo "checked";} ?> name="ckbox[2]" type="checkbox" class="tickbox2" id="ckbox[2]">

Aquarium<input <?php if (!(strcmp($row_Keyword_match['Keyword_ID'],3))) {echo "checked";} ?> name="ckbox[3]" type="checkbox" class="tickbox2" id="ckbox[3]">

etc.

The problem is that only the first matched checkbox is appearing as checked, and the others as unckecked.

Hopefully that makes some sense, and if anyobne can spot what is wrong it would be greatly appreciated.

Cheers,
Iain

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.