Advertisement
GWibisono

salahh logic?

Jul 29th, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     include "conn.php";
  3.     $kd_kelas=$_GET['kd_kelas'];
  4.     $query=mysql_fetch_array(mysql_query("select count(*) tot from kelas where kd_kelas='$kd_kelas'"));
  5. ?>
  6. <div class="post">
  7.     <h2 class="title"><a href="#">ABSENSI KELAS <?php echo $query['nama_kelas'];?></a></h2>
  8.     <p class="meta"><em>Aplikasi Absensi Multimedia<a href="#">SMK Wijaya Plus 2</a></em></p>
  9.     <div class="entry">
  10.         <p>
  11.         <form action="?page=proses" method="post" name="postform">
  12.         <input type="hidden" value="<?php echo $query['kd_kelas'];?>" name="kd_kelas"/>
  13. <h3>total siswa di kelas :<?php echo $query['tot'];?></h3>
  14. <?php
  15.  $query=mysql_query("select * from siswa where kd_kelas='$kd_kelas'") or die(mysql_error());
  16. ?>
  17.         <table class="datatable">
  18.         <tr>
  19.             <td width="24%" align="left" colspan="6">Tanggal : <input type="text" name="tanggal"  value="<?php
  20. if(empty($_POST['tgl'])){
  21.     echo $tanggal;
  22. }else{
  23.     echo "$_POST[tgl]$_GET[tgl]";
  24. }?>" size="11">
  25. <a
  26.     href="javascript:void(0)"
  27.     onClick="if(self.gfPop)gfPop.fPopCalendar(document.postform.tanggal);return false;" >
  28. <img name="popcal" align="absmiddle" src="calender/calbtn.gif" width="34" height="29" border="0" alt="">
  29. </a>
  30. </td>
  31.         </tr>
  32.         <tr>
  33.             <th>No</th>
  34.             <th>Nama</th>
  35.             <th>Hadir (H)</th>
  36.             <th>Sakit (S)</th>
  37.             <th>Ijin (I)</th>
  38.             <th>Alfa (A)</th>
  39.         </tr>
  40.         <?php
  41.         //penting nech buat kasih nilai awal radio bottom
  42.         $no=0; //dipake buat nomor
  43.        
  44.         while($row=mysql_fetch_array($query)){
  45.         ?>
  46.         <tr>
  47.             <td><?php echo ++$no;?></td>
  48.             <td><?php echo $row['nama'];?></td>        
  49.             <td align="center">            
  50. <?php
  51. /*****
  52.  saya perbaiki logic disini
  53. *****/
  54. ?>
  55.  
  56.               <input type="radio" name="hadir[<?php echo $row['kd_siswa'];?>]" value=1 />              
  57.             </td>
  58.            
  59.       <td align="center">
  60.                
  61.                 <input type="radio" name='sakit[<?php echo $row['kd_siswa'];?>]' value=1 />
  62.                
  63.                
  64.             </td>
  65.             <td align="center">
  66.                
  67.                 <input type="radio" name='ijin[<?php echo $row['kd_siswa'];?>]' value=1 />
  68.                
  69.             </td>
  70.             <td align="center">
  71.                
  72.                 <input type="radio" name='alpa[<?php echo $row['kd_siswa'];?>]' />             
  73.                
  74.             </td>
  75.         </tr>
  76.         <?php
  77.         }
  78.        
  79.         echo "
  80.             <tr>
  81.                 <td></td>
  82.                 <td></td>
  83.                 <td align=center>
  84.                 <input type='button' name='pilih' onclick='for (i=0;i<$no;i++){document.getElementById(i).checked=true;}' value='Check All'>
  85.                 </td>
  86.                 <td align=center>
  87.                 <input type='button' name='pilih' onclick='for (i=0;i<$no;i++){document.getElementById(i).checked=false;}' value='Uncheck All'>
  88.                 </td>
  89.                 <td></td>
  90.                 <td></td>
  91.             </tr>";
  92.         ?>
  93.         </table>
  94.         <br />
  95.         <input type="checkbox" name="selesai" value="yes" />Tandai Kelas Selesai
  96.         <br /><br />
  97.         <input type="submit" value="Submit" />
  98.         </form>
  99.         </p>
  100.   </div>
  101. </div>
  102.  
  103. <iframe width=174 height=189 name="gToday:normal:calender/agenda.js" id="gToday:normal:calender/agenda.js" src="calender/ipopeng.htm" scrolling="no" frameborder="0" style="visibility:visible; z-index:999; position:absolute; top:-500px; left:-500px;">
  104. </iframe>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement