Firdaus_Shinoda

list.php

Nov 1st, 2016
3,470
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.55 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.     <head>
  4.         <meta charset="UTF-8">
  5.         <title>List Mahasiswa</title>
  6.         <!-- Latest compiled and minified CSS -->
  7.         <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
  8.         <!-- Latest compiled and minified JavaScript -->
  9.         <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
  10.     </head>
  11.  
  12.     <body>
  13.         <div class="container">
  14.             <h2>Daftar Nama Mahasiswa</h2>
  15.             <table class="table">
  16.                 <tr>
  17.                     <td>NIM</td>
  18.                     <td>Nama</td>
  19.                     <td>Jenis Kelamin</td>
  20.                     <td>Alamat</td>
  21.                     <td>Edit</td>
  22.                     <td>Delete</td>
  23.                 </tr>
  24.                 <?php
  25.                 require("library.php");
  26.                 $Lib = new Library();
  27.                 $show = $Lib->showmahasiswa();
  28.                 while($data = $show->fetch(PDO::FETCH_OBJ)){
  29.                 echo "
  30.                 <tr>
  31.                     <td>$data->nim</td>
  32.                     <td>$data->nama</td>
  33.                     <td>$data->jenis_kelamin</td>
  34.                     <td>$data->alamat</td>
  35.                     <td><a class='btn btn-info' href='edit.php?id=$data->id'>Edit</td>
  36.                     <td><a class='btn btn-danger' href='list.php?delete=$data->nim'>Delete</a></td>
  37.                 </tr>";
  38.                 };
  39.                 ?>
  40.             </table>
  41.             <a href="index.php" class="btn btn-success">Tambah Mahasiswa Baru</a>
  42.         </div>
  43.     </body>
  44. </html>
  45.  
  46. <?php
  47. if(isset($_GET['delete'])){
  48. $del = $Lib->deleteMhs($_GET['delete']);
  49. header('Location: list.php');
  50. }
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment