<script>
$(document).ready(function(){
$("#submit").click(function(e){
e.preventDefault();
uid = $("input[name='user_id']:checked").map(function() {
return this.id;
}).get().join(",");
$.ajax({
type:"POST",
data:{"uid":uid},
url:"<?php echo base_url(); ?>hr/shortlist",
success:function(data){
setTimeout(function(){
location.reload();
}, 1000);
}
});
});
});
</script>
<table>
<thead>
<tr class="info">
<th>Check</th>
<th>Recruiter Id</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<input type="checkbox" name="user_id" id="uid1211120937" class="user_id">
</td>
<td>20181123091338</td>
</tr>
<tr>
<td>
<input type="checkbox" name="user_id" id="uid1211092847" class="user_id">
</td>
<td>20181123091338</td>
</tr>
</tbody>
</table>
<input type="submit" name="submit" id="submit" value="short"/>
shortlist.php
$uid = explode(",",$this->input->post('uid'));
foreach($uid as $user_id)
{
$data = array('shortlist'=>'1');
$this->db->where('uid',$user_id);
$query = $this->db->update('personal_detail',$data);
}
В этом вопросе у меня несколько флажков.Теперь, что я хочу, если, если я установил флажок «все», то shortlist must be 1 for all
будет обновлен, а если я сниму флажок, то uncheck checkbox value will be 0
.Итак, как я могу это сделать?Пожалуйста, помогите мне.
Спасибо