PHP buat tindakan secara pukal guna check box
JAVASCRIPT
<script type="text/javascript">
$(document).ready(function(){
$("#checkAll").click(function() {
if($(this).is(':checked')) {
$("input[name='chckbox[]']").attr('checked',true)
} else {
$("input[name='chckbox[]']").attr('checked',false)
}
});
});
</script>
HTML
<table id="table_list" width="100%" border="0" cellspacing="0" cellpadding="0" class="maintable">
<tr>
<th class="" width="25">Bil</th>
<th class="" width="83">Tarikh Permohonan</th>
<th class="" width="97">No Rujukan</th>
<th class="" width="131">Nama</th>
<th class="" width="77">No Kad Pengenalan</th>
<th width="78" class="">Jenis Perjalanan</th>
<th width="81">Tempat / Lokasi</th>
<th width="76">Negara</th>
<th width="62">Tarikh Mula</th>
<th width="82">Jumlah Hari</th>
<th width="86">Status</th>
<th width="65">Tindakan</th>
<th width="70">Pilih Semua
<input name="checkAll" type="checkbox" id="checkAll" />
</th>
</tr>
<?php if($totalRows > 0) {
$i=$start;
do {
$i++;
$date1 = $rows['tkh_mula'];
$date2 = $rows['tkh_akhir'];
$diff = abs(strtotime($date2) - strtotime($date1));
$years = floor($diff / (365*60*60*24));
$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
$days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
?>
<tr class="table_td">
<td align="center"><?php echo $i; ?></td>
<td align="center"><?php echo $rows['tkh_mohon']!=''? date('d-m-Y',strtotime($rows['tkh_mohon'])):''; ?></td>
<td align="center"><?php echo $rows['no_rujukan']; ?></td>
<td><?php echo $rows['nama_penuh']; ?></td>
<td align="center"><?php echo $rows['no_kp_baru']; ?></td>
<td align="center"><?php echo $rows['perjalanan_keterangan']; ?></td>
<td align="center"><?php echo $rows['lokasi']; ?></td>
<td align="center"><?php echo $rows['negara_keterangan']; ?></td>
<td align="center"><?php echo $rows['tkh_mula']!=''? date('d-m-Y',strtotime($rows['tkh_mula'])):''; ?></td>
<td align="center"><?php printf("%d hari\n", $days); ?></td>
<td align="center"><?php echo $rows['status_keterangan']; ?></td>
<td align="center"><?php //echo $rows['']; ?>
<a href="#" name="<?php echo $rows['id'];?>" class="view"><img class="noborder" src="../images/papar.png" title="Papar" width="22" height="22" /></a>
</td>
<td align="center">
<input name="chckbox[]" type="checkbox" id="checkbox1<?php echo $i; ?>" value="<?php echo $rows['id']; ?>" onclick="$('#checkAll').attr('checked',false)" />
</td>
</tr>
<?php } while ($rows= mysqli_fetch_assoc($result)); ?>
<?php } else { ?>
<tr class="table_td">
<td colspan="11" align="center"><?php echo "TIADA MAKLUMAT"; ?></td>
</tr>
<?php } ?>
</table>
~banu~
0 comments:
Post a Comment