Advertisement
mrs_cl4y

Edit_1IA01.php

May 29th, 2015
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.04 KB | None | 0 0
  1. <?php
  2. /*
  3. pertama.. targetnya blum km tentukan ke edit
  4. kedua.. targetnya tetap disini aja
  5. ketiga.. kl udah silakan komen die nya
  6. keempat. perhatikan array yg saya masukkan
  7.  
  8. kelima.. jgn pake mysql_ pake pdo lebih bagus*/
  9.  
  10. if(count($_POST)>1){
  11. die('<pre>'.print_r($_POST,1));
  12. include "koneksi.php";
  13. foreach($_POST['npm'] as $npm){
  14. $absen=$_POST['absen'][$npm];
  15. $tugas1=$_POST['tugas1'][$npm];
  16. $tugas2=$_POST['tugas2'][$npm];
  17. $tugas3=$_POST['tugas3'][$npm];
  18. $nilai_ujian=$_POST['nilai_ujian'][$npm];
  19.  
  20. $sql="UPDATE mhsnilai SET absen='$absen',tugas1='$tugas1', tugas2='$tugas2', tugas3='$tugas3', nilai_ujian='$nilai_ujian'";
  21.  
  22. }
  23.  
  24. }else{
  25. //lanjutkan
  26. }
  27. ?>
  28. <html>
  29.  
  30. <head>
  31.  
  32. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  33.  
  34. <title>Pengelola Nilai Mahasiswa</title>
  35.  
  36. <link href="css/tooplate_style.css" rel="stylesheet" type="text/css" />
  37.  
  38. <script type="text/javascript" src="js/swfobject.js"></script>
  39.  
  40. <script type="text/javascript">
  41.  
  42. var flashvars = {};
  43.  
  44. flashvars.xml_file = "photo_list.xml";
  45.  
  46. var params = {};
  47.  
  48. params.wmode = "transparent";
  49.  
  50. var attributes = {};
  51.  
  52. attributes.id = "slider";
  53.  
  54. swfobject.embedSWF("flash_slider.swf", "flash_grid_slider", "780", "210", "9.0.0", false, flashvars, params, attributes);
  55.  
  56. </script>
  57.  
  58. </head>
  59.  
  60. <body>
  61.  
  62. <div id="tooplate_wrapper">
  63.  
  64. <div id="tooplate_header">
  65.  
  66. <div id="tooplate_menu">
  67.  
  68. <ul>
  69.  
  70. <li><a class="current">Saya Dosen</a></li>
  71.  
  72. <li><a href="index.html" class="current">Logout</a></li>
  73.  
  74. </ul>
  75.  
  76. </div> <!-- end of tooplate_menu -->
  77.  
  78. </div> <!-- end of forever header -->
  79.  
  80. <div id="tooplate_middle">
  81.  
  82. <div id="flash_grid_slider">
  83.  
  84. <a rel="nofollow" href="http://www.adobe.com/go/getflashplayer">
  85.  
  86. <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
  87.  
  88. </a>
  89.  
  90. </div>
  91.  
  92. </div> <!-- end of middle -->
  93.  
  94. <div id="tooplate_content"><span class="content_top"></span>
  95.  
  96. <!-- dari sini logika loginnya-->
  97.  
  98. <div class="cleaner h40"></div>
  99.  
  100. <form action="update.php" method="post">
  101.  
  102. <center>
  103.  
  104. <h1>Edit Data Mahasiswa</h1>
  105.  
  106. <table border="1" style="border-collapse:collapse" width="100%">
  107.  
  108. <tr style="background:orange;">
  109.  
  110. <!-- di gunakan untuk membuat label nama fieldnya-->
  111.  
  112. <th>NPM</th>
  113.  
  114. <th>Nama</th>
  115.  
  116. <th>Kelas</th>
  117.  
  118. <th>Absen</th>
  119.  
  120. <th>Tugas 1</th>
  121.  
  122. <th>Tugas 2</th>
  123.  
  124. <th>Tugas 3</th>
  125.  
  126. <th>Nilai Ujian</th>
  127.  
  128. <th>Grade</th>
  129.  
  130. </tr>
  131.  
  132.  
  133. <?php
  134.  
  135. include "koneksi.php";
  136.  
  137. $sql="SELECT * FROM mhsnilai where kelas<='1IA01' order by nama";
  138.  
  139. $result=mysqli_query($conn,$sql) or die(mysqli_error());
  140.  
  141. while ($row=mysqli_fetch_array($result)) {
  142.  
  143. extract($row);
  144.  
  145. ?>
  146.  
  147. <tr>
  148.  
  149. <td><?php echo $npm ?><input type=hidden name=npm[] value='<?php echo $npm;?>' /></td>
  150.  
  151. <td><?php echo $nama ?></td>
  152.  
  153. <td><?php echo $kelas ?></td>
  154.  
  155. <td><center><input name='absen[<?php echo $npm;?>]' placeholder="absen" size='4' maxlength='4' type=text value= '<?php echo $absen ?>'></center></td>
  156.  
  157. <td><center><input name='tugas1[<?php echo $npm;?>]' placeholder="tugas1" size='4' maxlength='4' type=text value='<?php echo $tugas1 ?>'></center></td>
  158.  
  159. <td><center><input name='tugas2[<?php echo $npm;?>]' placeholder='tugas2' size='4' maxlength='4' type=text value='<?php echo $tugas2 ?>'></center></td>
  160.  
  161. <td><center><input name='tugas3[<?php echo $npm;?>]' placeholder='tugas3' size='4' maxlength='4' type=text value='<?php echo $tugas3 ?>'></center></td>
  162.  
  163. <td><center><input name='nilai_ujian[<?php echo $npm;?>]' placeholder='nilai_ujian' size='5' maxlength='5' type=text value='<?php echo $nilai_ujian?>'></center></td>
  164.  
  165. <td><center><?php echo $grade ?></center></td>
  166.  
  167. </tr>
  168.  
  169. <?php
  170.  
  171. }
  172.  
  173. ?>
  174.  
  175. </table>
  176.  
  177.  
  178.  
  179. <input type="submit" value="Simpan">
  180. </center>
  181. </form>
  182.  
  183. <center>
  184.  
  185.  
  186.  
  187. </center>
  188.  
  189. <div class="cleaner"></div>
  190.  
  191. </div> <!-- end of content -->
  192.  
  193. <div id="tooplate_footer">
  194.  
  195. Copyright © 2048 <a href="#">Company Name</a>
  196.  
  197. <div class="cleaner"></div>
  198.  
  199. </div>
  200.  
  201. </div> <!-- end of wrapper -->
  202.  
  203. </body>
  204.  
  205. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement