Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once ('configuration.php');
- ?>
- <div class="dt-responsive table-responsive">
- <table id="koding-asal" class="table table-striped table-bordered nowrap">
- <thead>
- <tr>
- <th>No</th>
- <th>Nama Provinsi</th>
- <th>Kode</th>
- <th>Ibu Kota</th>
- <th>Gubernur</th>
- <th>Tindakan</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $cek_data = "select *from tbl_provinsi order by cl_id desc";
- $query = mysqli_query($connection,$cek_data); $no=1;
- while($row = mysqli_fetch_array($query)){
- ?>
- <tr>
- <td align="center"><?php echo $no?></td>
- <td align="justify"><?php echo $row['cl_provinsi']?></td>
- <td align="justify"><?php echo $row['cl_kode']?></td>
- <td align="justify"><?php echo $row['cl_kota']?></td>
- <td align="justify"><?php echo $row['cl_gubernur']?></td>
- <td align="center">
- <a href="#" class="text-success" onclick="myEdit_<?php echo $no?>()"><i class="fa fa-edit fa-lg"></i></a>
- <a href="#" class="text-danger" onclick="myDelete_<?php echo $no?>()"><i class="fa fa-trash fa-lg"></i></a>
- </td>
- <script type="text/javascript">
- function myEdit_<?php echo $no?>() {
- document.getElementById("id").value = "<?php echo $row['cl_id']?>";
- document.getElementById("kode_prov").value = "<?php echo $row['cl_kode']?>";
- document.getElementById("provinsi").value = "<?php echo $row['cl_provinsi']?>";
- document.getElementById("kota").value = "<?php echo $row['cl_kota']?>";
- document.getElementById("gubernur").value = "<?php echo $row['cl_gubernur']?>";
- }
- function myDelete_<?php echo $no?>() {
- $.ajax({ type: "GET",
- url: "hapus_data.php?id=<?php echo $row['cl_id']?>",
- async: false,
- success : function(text)
- {
- if(text = "sukses"){
- $("#load-page").load("load_tabel.php");
- }else{
- alert ('proses gagal');
- }
- }
- });
- }
- </script>
- </tr>
- <?php $no++;}?>
- </tbody>
- <tfoot>
- <tr>
- <th>No</th>
- <th>Nama Provinsi</th>
- <th>Kode</th>
- <th>Ibu Kota</th>
- <th>Gubernur</th>
- <th>Tindakan</th>
- </tr>
- </tfoot>
- </table>
- </div>
- <script src="js/extension-btns-custom.js" type="46fdda76826106b979343b7a-text/javascript"></script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement