Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- pertama.. targetnya blum km tentukan ke edit
- kedua.. targetnya tetap disini aja
- ketiga.. kl udah silakan komen die nya
- keempat. perhatikan array yg saya masukkan
- kelima.. jgn pake mysql_ pake pdo lebih bagus*/
- if(count($_POST)>1){
- die('<pre>'.print_r($_POST,1));
- include "koneksi.php";
- foreach($_POST['npm'] as $npm){
- $absen=$_POST['absen'][$npm];
- $tugas1=$_POST['tugas1'][$npm];
- $tugas2=$_POST['tugas2'][$npm];
- $tugas3=$_POST['tugas3'][$npm];
- $nilai_ujian=$_POST['nilai_ujian'][$npm];
- $sql="UPDATE mhsnilai SET absen='$absen',tugas1='$tugas1', tugas2='$tugas2', tugas3='$tugas3', nilai_ujian='$nilai_ujian'";
- }
- }else{
- //lanjutkan
- }
- ?>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Pengelola Nilai Mahasiswa</title>
- <link href="css/tooplate_style.css" rel="stylesheet" type="text/css" />
- <script type="text/javascript" src="js/swfobject.js"></script>
- <script type="text/javascript">
- var flashvars = {};
- flashvars.xml_file = "photo_list.xml";
- var params = {};
- params.wmode = "transparent";
- var attributes = {};
- attributes.id = "slider";
- swfobject.embedSWF("flash_slider.swf", "flash_grid_slider", "780", "210", "9.0.0", false, flashvars, params, attributes);
- </script>
- </head>
- <body>
- <div id="tooplate_wrapper">
- <div id="tooplate_header">
- <div id="tooplate_menu">
- <ul>
- <li><a class="current">Saya Dosen</a></li>
- <li><a href="index.html" class="current">Logout</a></li>
- </ul>
- </div> <!-- end of tooplate_menu -->
- </div> <!-- end of forever header -->
- <div id="tooplate_middle">
- <div id="flash_grid_slider">
- <a rel="nofollow" href="http://www.adobe.com/go/getflashplayer">
- <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
- </a>
- </div>
- </div> <!-- end of middle -->
- <div id="tooplate_content"><span class="content_top"></span>
- <!-- dari sini logika loginnya-->
- <div class="cleaner h40"></div>
- <form action="update.php" method="post">
- <center>
- <h1>Edit Data Mahasiswa</h1>
- <table border="1" style="border-collapse:collapse" width="100%">
- <tr style="background:orange;">
- <!-- di gunakan untuk membuat label nama fieldnya-->
- <th>NPM</th>
- <th>Nama</th>
- <th>Kelas</th>
- <th>Absen</th>
- <th>Tugas 1</th>
- <th>Tugas 2</th>
- <th>Tugas 3</th>
- <th>Nilai Ujian</th>
- <th>Grade</th>
- </tr>
- <?php
- include "koneksi.php";
- $sql="SELECT * FROM mhsnilai where kelas<='1IA01' order by nama";
- $result=mysqli_query($conn,$sql) or die(mysqli_error());
- while ($row=mysqli_fetch_array($result)) {
- extract($row);
- ?>
- <tr>
- <td><?php echo $npm ?><input type=hidden name=npm[] value='<?php echo $npm;?>' /></td>
- <td><?php echo $nama ?></td>
- <td><?php echo $kelas ?></td>
- <td><center><input name='absen[<?php echo $npm;?>]' placeholder="absen" size='4' maxlength='4' type=text value= '<?php echo $absen ?>'></center></td>
- <td><center><input name='tugas1[<?php echo $npm;?>]' placeholder="tugas1" size='4' maxlength='4' type=text value='<?php echo $tugas1 ?>'></center></td>
- <td><center><input name='tugas2[<?php echo $npm;?>]' placeholder='tugas2' size='4' maxlength='4' type=text value='<?php echo $tugas2 ?>'></center></td>
- <td><center><input name='tugas3[<?php echo $npm;?>]' placeholder='tugas3' size='4' maxlength='4' type=text value='<?php echo $tugas3 ?>'></center></td>
- <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>
- <td><center><?php echo $grade ?></center></td>
- </tr>
- <?php
- }
- ?>
- </table>
- <input type="submit" value="Simpan">
- </center>
- </form>
- <center>
- </center>
- <div class="cleaner"></div>
- </div> <!-- end of content -->
- <div id="tooplate_footer">
- Copyright © 2048 <a href="#">Company Name</a>
- <div class="cleaner"></div>
- </div>
- </div> <!-- end of wrapper -->
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement