i have table admin_rouls
Through it, I control the setting of the admin's permission for the category topics
i try to give each admin permission
for example admin id 9 give him permission to category id 20 can edit or add new topic but cant delete
ID admin_id cat can_add can_edit can_del
1 9 20 Y Y N
2 9 19 N Y N
3 9 18 N N Y
i used this form
<form method="post">
<?php
$GetCats=mysqli_query($db,"select * from section where id_sec = 0");
while($rowCat=mysqli_fetch_object($GetCats))
{
echo $rowCat->name ;
echo '<div class="pull-left">
ADD
<input type="checkbox" name="add_cat['.$rowCat->id.']" >
EDIT
<input type="checkbox" name="edit_cat['.$rowCat->id.']" >
DELETE
<input type="checkbox" name="del_cat['.$rowCat->id.']" >
</div>';
}
?>
<input type="hidden" name="AdminId" value="<?php echo $_GET['id'];?>">
<input type="submit" name="submit" value="save">
</form>
post data come like that
add_cat[50]=on&edit_cat[50]=on&del_cat[50]=on&add_cat[100]=on&edit_cat[100]=on&edit_cat[70]=on&del_cat[70]=on&AdminId=5&submit=save
I have a problem how insert this data to database table
with many category id same 50 100 70 and option same add_cat edit_cat del_cat
ID admin_id cat can_add can_edit can_del
1 9 20 Y Y N
2 9 19 N Y N
3 9 18 N N Y
any idea ??
My Answer:
Rate this post
4 of 5 based on 3539 votesComments