Advertisement
isnan_ha18

load_page

Jan 23rd, 2020
530
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.43 KB | None | 0 0
  1. <?php
  2.     require_once ('configuration.php');
  3. ?>
  4. <div class="dt-responsive table-responsive">
  5.     <table id="koding-asal" class="table table-striped table-bordered nowrap">
  6.         <thead>
  7.             <tr>
  8.                 <th>No</th>
  9.                 <th>Nama Provinsi</th>
  10.                 <th>Kode</th>
  11.                 <th>Ibu Kota</th>
  12.                 <th>Gubernur</th>
  13.                 <th>Tindakan</th>
  14.             </tr>
  15.         </thead>
  16.         <tbody>
  17.         <?php
  18.             $cek_data = "select *from tbl_provinsi order by cl_id desc";
  19.             $query = mysqli_query($connection,$cek_data); $no=1;
  20.             while($row = mysqli_fetch_array($query)){
  21.         ?>
  22.             <tr>
  23.                 <td align="center"><?php echo $no?></td>
  24.                 <td align="justify"><?php echo $row['cl_provinsi']?></td>
  25.                 <td align="justify"><?php echo $row['cl_kode']?></td>
  26.                 <td align="justify"><?php echo $row['cl_kota']?></td>
  27.                 <td align="justify"><?php echo $row['cl_gubernur']?></td>
  28.                 <td align="center">
  29.                     <a href="#" class="text-success" onclick="myEdit_<?php echo $no?>()"><i class="fa fa-edit fa-lg"></i></a>
  30.                     <a href="#" class="text-danger" onclick="myDelete_<?php echo $no?>()"><i class="fa fa-trash fa-lg"></i></a>  
  31.                 </td>
  32.                 <script type="text/javascript">
  33.                     function myEdit_<?php echo $no?>() {
  34.                         document.getElementById("id").value = "<?php echo $row['cl_id']?>";
  35.                         document.getElementById("kode_prov").value = "<?php echo $row['cl_kode']?>";
  36.                         document.getElementById("provinsi").value = "<?php echo $row['cl_provinsi']?>";
  37.                         document.getElementById("kota").value = "<?php echo $row['cl_kota']?>";
  38.                         document.getElementById("gubernur").value = "<?php echo $row['cl_gubernur']?>";
  39.                     }
  40.                     function myDelete_<?php echo $no?>() {
  41.                         $.ajax({ type: "GET",  
  42.                             url: "hapus_data.php?id=<?php echo $row['cl_id']?>",  
  43.                             async: false,
  44.                             success : function(text)
  45.                                 {
  46.                                     if(text = "sukses"){
  47.                                         $("#load-page").load("load_tabel.php");
  48.                                     }else{
  49.                                         alert ('proses gagal');
  50.                                     }
  51.                                 }
  52.                         });
  53.                     }
  54.                 </script>
  55.             </tr>
  56.         <?php $no++;}?>
  57.         </tbody>
  58.         <tfoot>
  59.             <tr>
  60.                 <th>No</th>
  61.                 <th>Nama Provinsi</th>
  62.                 <th>Kode</th>
  63.                 <th>Ibu Kota</th>
  64.                 <th>Gubernur</th>
  65.                 <th>Tindakan</th>
  66.             </tr>
  67.         </tfoot>
  68.     </table>
  69. </div>
  70.  
  71. <script src="js/extension-btns-custom.js" type="46fdda76826106b979343b7a-text/javascript"></script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement