我编写了以下代码片段来编辑或更新我的权限,这样当我点击编辑按钮时,就会出现勾选/取消选中复选框。
<?php
}
}
$id=$_REQUEST['user'];
if(isset($_GET['showtab']) && $_GET['showtab']==1) {
$result=doQuery("SELECT user,
account,
firstname,
lastname,
branchname,
username
FROM web_webusers WHERE user='".(int)$id."'");
$test = mysql_fetch_array($result);
$user=$test['user'];
$firstname=$test['firstname'];
$lastname=$test['lastname'];
$branchname=$test['branchname'];
$username=$test['username'];
$result=doQuery("SELECT user,
AllowAddAddressBook,
AllowEditAddressBook,
AllowAddPrealert,
AllowEditPrealert,
AllowAddUser
FROM web_clientuser_permission WHERE user='". (int)$id."'");
$test = mysql_fetch_array($result);
$user=$test['user'];
$AllowAddAddressBook=$test['AllowAddAddressBook'];
$AllowEditAddressBook=$test['AllowEditAddressBook'];
$AllowAddPrealert=$test['AllowAddPrealert'];
$AllowEditPrealert=$test['AllowEditPrealert'];
$AllowAddUser=$test['AllowAddUser'];
}
?>
<div class="row">
&GT;
&GT;允许添加地址簿
<div class="col-sm-6">
<input type="hidden" name="AllowEditAddressBook" id="AllowEditAddressBook" value="0"<?php echo ($AllowEditAddressBook==1) ? ' check' : '' ?>>
<label><input type="checkbox" name="AllowEditAddressBook" id="AllowEditAddressBook" value="1"> Allow Edit Address Book</label>
&GT;
&GT;允许添加预警
<div class="col-sm-6">
<input type="hidden" name="AllowAddUser" id="AllowAddUser" value="0" <?php echo ($AllowAddUser==1) ? ' check' : '' ?>>
<label><input type="checkbox" name="AllowAddUser" id="AllowAddUser" value="1" <?php echo ($AllowAddUser==1) ? ' check' : '' ?>> Allow Add User</label>
</div>
</div>
<br>
<center>
<button type="submit" name="saveuserinfo" value="1" class="btn btn-success"><i class="icon-save icon-large"></i> Save</button>
<center></div>
是否有可能实现我的要求?关于如何实现我要求的概念的任何意见将不胜感激。
提前致谢!