![]() |
Matching an ID within an array
I have been scratching my head with this one for a couple hours now. Heres my problem;
i have two databases; 1) Categories 2) Roles within ROLES i have; ADMIN(id:1), BLOG(id:2), CMS(id:3) in CATEGORIES i have; SECTION1, SECTION2, SECTION3 each CATEGORIE has different roles attached, for example; SECTION1 can be viewed by ADMIN and CMS - 1,3 SECTION2 can be viewed by ADMIN and BLOG - 1,2 SECTION3 can be viewed by ALL - 1,2,3 I have been trying to show these roles in a checkbox format, for editing purposes. However im not quite getting it right :( PHP Code:
Code:
<p><input type="checkbox" id="role[]" name="role[]" value="<?php echo $role['id']; ?>" class="checkbox" <?php if($role['id'] == $role['id']) { echo 'checked="checked"'; } ?> /> <?php echo $role['name']; ?></p>Any help would be appreciated. |
solved this problem with in_array().
amazing! |
| All times are GMT. The time now is 01:50 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0