我正在做一個頁面,我可以用複選框顯示數據列表。那麼我會自動檢查數據庫,如果數據在那裏,複選框將被檢查。我現在想要做的是,讓我們說複選框被自動檢查,並且當我自己取消選中並保存時,它將更新數據庫中的數據。我的編碼如何自動選中和取消選中複選框
例子:
<form action="{{URL::to('/granted/'.$d->id)}}" method="get">
<input name="_token" type="hidden" value="{{ csrf_token() }}"/>
@foreach($var as $v)
<table style="margin-left:20px;">
<caption>{{$v->module_groupname}}</caption>
@foreach($name as $n)
<?php if($n->module_groupname == $v->module_groupname){?>
<tr><td width="80"><input type="checkbox" name="module_code[]" value="{{ $n->module_code }}"
<?php foreach($priv as $p){
if($p->user_id == $d->id){
if($p->module_code == $n->module_code){
echo 'checked="checked"';
}
}
}?>></td>
<td width="150">{{$n->module_groupname}}</td>
<td width="200">{{ $n->module_desc}}</td>
</tr> <?php } ?>
@endforeach
</table>
<hr>
@endforeach
<input type="submit" value="select" class="btn btn-s btn-success">
</form>
我一直勸查找給PLUS聲明甲骨文,但我無法找到