SY_angel wrote:
> But another problem I had was when I reach the 'Edit'
page, the checkboxes
> were all not ticked.
> E.g. Person A belongs to the Category of
'Admin,Accounts'
> The checkbox of Admin and Accounts in the Edit page was
not checked.
You need to do a little hand-coding to deal with this
situation.
Immediately before the first checkbox, add this line of code
to extract
the values in the field into an array called $categories:
<?php $categories =
explode(',',$row_rsEditCandidate['JobCategory']); ?>
Then change the checkbox code like this:
<input name="JobCategory[]" type="checkbox"
value="Electrical" <?php
if (is_array($categories) && in_array("Electrical",
$categories))
{echo 'checked="checked"';} ?> />
The conditional statement first checks that $categories is an
array.
This prevents an error if $row_rsEditCandidate['JobCategory']
was empty.
The code then looks for "Electrical" in the $categories
array. Even if
there's only one item in $row_rsEditCandidate['JobCategory'],
$categories will still be an array. Just replace "Electrical"
with the
appropriate value for each checkbox.
I have also corrected echo "CHECKED". It looks as though
you're using a
version of Dreamweaver that doesn't use the correct syntax
for XHTML.
--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/