humaidi

bk-tamu.php

Oct 14th, 2023
495
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.85 KB | Source Code | 0 0
  1. <?php
  2.  
  3. // koneksi
  4. require_once "config/koneksi.php";
  5.  
  6. // query user
  7. $sql_komentar = mysqli_query($con, "SELECT * FROM komentar ORDER BY id DESC") or die(mysqli_error($con));
  8.  
  9. ?>
  10.  
  11. <html>
  12.  
  13. <head>
  14.     <title>Buku Tamu</title>
  15.     <link rel="stylesheet" type="text/css" href="belajar2.css">
  16. </head>
  17.  
  18. <style>
  19.     body {
  20.         font-family: 'Poppins', sans-serif;
  21.     }
  22.  
  23.     form {
  24.         width: 400px;
  25.         /* Lebar form sesuai kebutuhan Anda */
  26.         margin: 0 auto;
  27.         /* Untuk mengatur posisi form ke tengah halaman */
  28.         padding: 20px;
  29.         /* Spasi dalam form */
  30.     }
  31.  
  32.  
  33.     td {
  34.         padding: 5px;
  35.         /* Spasi dalam sel */
  36.     }
  37.  
  38.     input[type="text"],
  39.     textarea {
  40.         width: 100%;
  41.         padding: 8px;
  42.         /* Spasi dalam input text dan textarea */
  43.         margin-bottom: 10px;
  44.         /* Jarak antar field */
  45.     }
  46.  
  47.     input[type="submit"] {
  48.         background-color: #007bff;
  49.         /* Warna latar belakang tombol submit */
  50.         color: #fff;
  51.         /* Warna teks tombol submit */
  52.         padding: 10px 20px;
  53.         /* Spasi dalam tombol submit */
  54.         border: none;
  55.         /* Hapus border tombol submit */
  56.         cursor: pointer;
  57.         /* Ubah kursor menjadi tangan saat mengarahkan ke tombol submit */
  58.     }
  59.  
  60.     table {
  61.         border-collapse: collapse;
  62.     }
  63.  
  64.     .tombol {
  65.         display: inline-block;
  66.         padding: 3px 5px;
  67.         background-color: #007bff;
  68.         /* Warna latar belakang tombol */
  69.         color: #fff;
  70.         /* Warna teks tombol */
  71.         text-decoration: none;
  72.         font-size: 12px;
  73.         /* Menghapus garis bawah dari tautan */
  74.         border: none;
  75.         /* Menghapus border */
  76.         border-radius: 5px;
  77.         /* Membuat sudut tombol menjadi agak melengkung */
  78.     }
  79.  
  80.     /* Gaya saat tombol diklik (opsional) */
  81.     .tombol:hover {
  82.         background-color: #063669;
  83.         /* Warna latar belakang saat tombol dihover */
  84.     }
  85.  
  86.  
  87.  
  88.     /* tabel tamu */
  89.     .tamu {
  90.         border-collapse: collapse;
  91.         width: 100%;
  92.     }
  93.  
  94.     .tamu th,
  95.     .tamu td {
  96.         border: 1px solid #000;
  97.         padding: 8px;
  98.         text-align: left;
  99.     }
  100.  
  101.     .tamu th {
  102.         background-color: #f2f2f2;
  103.     }
  104.  
  105.     .tamu tr:nth-child(even) {
  106.         background-color: #f2f2f2;
  107.     }
  108.  
  109.     .tamu tr:hover {
  110.         background-color: #ccc;
  111.     }
  112.  
  113.     .tamu a {
  114.         text-decoration: none;
  115.     }
  116.  
  117.     .edit {
  118.         display: inline-block;
  119.         padding: 3px 12px;
  120.         background-color: #007BFF;
  121.         color: #fff;
  122.         font-size: 12px;
  123.         text-decoration: none;
  124.         border: none;
  125.         cursor: pointer;
  126.         border-radius: 5px;
  127.         font-weight: bold;
  128.     }
  129.  
  130.     .hapus {
  131.         display: inline-block;
  132.         padding: 3px 5px;
  133.         background-color: #E92F2F;
  134.         color: #fff;
  135.         font-size: 12px;
  136.         text-decoration: none;
  137.         border: none;
  138.         cursor: pointer;
  139.         border-radius: 5px;
  140.         font-weight: bold;
  141.     }
  142.  
  143.     .edit:hover,
  144.     .hapus:hover {
  145.         background-color: #043161;
  146.     }
  147. </style>
  148.  
  149.  
  150. <body>
  151.  
  152.     <table width="750" style=" border: 1px solid #60A1EB;" border="1" align="center" cellpadding="0" cellspacing="0">
  153.         <tr>
  154.             <td width="200">&nbsp;</td>
  155.             <td colspan="2">
  156.                 <a href="index.php" class="tombol">Home</a> ||
  157.                 <a href="profile.php" class="tombol">Profile</a> ||
  158.                 <a href="kontak.php" class="tombol">Kontak</a> ||
  159.                 <a href="bk-tamu.php" class="tombol">Buku Tamu</a>
  160.             </td>
  161.         </tr>
  162.  
  163.         <tr>
  164.             <td colspan="3">
  165.                 <marquee>Tidak ada kata terlambat untuk memulai hal baru.</marquee>
  166.             </td>
  167.         </tr>
  168.  
  169.         <tr>
  170.             <td>&nbsp;</td>
  171.             <td width="500" style="padding: 10px;"><strong>
  172.                     <h1>DAFTAR TAMU</h1>
  173.                 </strong>
  174.  
  175.                 <table border="1" class="tamu">
  176.                     <thead>
  177.                         <tr>
  178.                             <th>No</th>
  179.                             <th>Nama</th>
  180.                             <th>Email</th>
  181.                             <th>Komentar</th>
  182.                             <th style="text-align:center;">Aksi</th>
  183.                         </tr>
  184.                     </thead>
  185.  
  186.                     <tbody>
  187.  
  188.                         <?php if (mysqli_num_rows($sql_komentar) > 0) { ?>
  189.                             <?php
  190.                             $i = 1;
  191.                             while ($row = mysqli_fetch_array($sql_komentar)) { ?>
  192.  
  193.                                 <tr>
  194.                                     <td><?= $i ?>.</td>
  195.                                     <td><?= $row['nama'] ?></td>
  196.                                     <td><?= $row['email'] ?></td>
  197.                                     <td><?= $row['komentar'] ?></td>
  198.                                     <td>
  199.                                         <a href="edit_bk_tm.php?id=<?= $row['id'] ?>" class="edit">Edit</a>
  200.                                         <hr>
  201.                                         <a href="hapus.php?id=<?= $row['id'] ?>" onclick="return confirm('apakah yakin akan menghapus data ini..?')" class="hapus">Hapus</a>
  202.                                     </td>
  203.                                 </tr>
  204.  
  205.                             <?php $i++;
  206.                             } ?>
  207.                         <?php } ?>
  208.  
  209.                     </tbody>
  210.                 </table>
  211.  
  212.             </td>
  213.             <td width="75">
  214.                 <img src="ikon/hello.gif" alt="">
  215.             </td>
  216.         </tr>
  217.  
  218.         <tr>
  219.             <td colspan="3">
  220.                 <center>Copyright @ 2023 by Humaidi Zakaria, A.Md</center>
  221.             </td>
  222.         </tr>
  223.     </table>
  224. </body>
  225.  
  226. </html>
Advertisement
Add Comment
Please, Sign In to add comment