[php] 1
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
- <?php
- require "config.php";
- $meja = tampil("SELECT * FROM meja");
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Halaman Admin</title>
- <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
- </head>
- <body>
- <div class="container">
- <div class="row">
- <div class="col">
- <h6 class="py-3">Hello, Admin</h6>
- <h1 class="pb-3">Data Meja Rumah Makan</h1>
- </div>
- </div>
- <div class="row">
- <div class="col">
- <div class="card">
- <div class="card-body">
- <div class="table-responsive">
- <table class="table table-bordered table-striped table-hover">
- <tr>
- <th>No</th>
- <th>Meja</th>
- <th>Status</th>
- <th>Lampu</th>
- <th>Edit</th>
- </tr>
- <?php $no = 1; ?>
- <?php foreach ($meja as $row) : ?>
- <tr>
- <td><?= $no ?></td>
- <td><?= $row["nama"] ?></td>
- <td><?= $row["status"] ?></td>
- <td>
- <?php
- if ($row["status"] == 1) {
- echo "<div class='btn btn-success'>Nyala</div>";
- } else {
- echo "<div class='btn btn-danger'>Mati</div>";
- }
- ?>
- </td>
- <td>
- <!-- <a href="ubah.php?id=<?= $row["id"] ?>">Ubah</a> -->
- <a href="#" data-bs-toggle="modal" data-bs-target="#modalUbah<?= $no ?>" class="btn btn-outline-warning">Ubah</a>
- </td>
- </tr>
- <!-- Modal -->
- <div class="modal fade" id="modalUbah<?= $no ?>" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <h1 class="modal-title fs-5" id="staticBackdropLabel">Ubah Data</h1>
- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
- </div>
- <form action="update.php" method="post" enctype="multipart/form-data">
- <input type="hidden" name="id" value="<?= $row['id'] ?>">
- <div class="modal-body">
- <div class="mb-3">
- <label for="namaMeja">Nama Meja</label>
- <select class="form-select" name="namaMeja">
- <option value="<?= $row['namaMeja'] ?>"><?= $row['namaMeja'] ?></option>
- <?php
- for ($i = 1; $i < 10; $i++) {
- echo "<option value='Meja $i'>Meja $i</option>";
- }
- ?>
- </select>
- </div>
- <div class="mb-3">
- <label for="status">Status Meja</label>
- <select class="form-select" name="status">
- <option value="0">Mati</option>
- <option value="1">Nyala</option>
- </select>
- </div>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Tutup</button>
- <button type="submit" class="btn btn-primary" name="ubah">Konfirmasi</button>
- </div>
- </form>
- </div>
- </div>
- </div>
- <?php $no++; ?>
- <?php endforeach; ?>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
- </body>
- </html>
Editor
You can edit this paste and save as new:
File Description
- 1
- Paste Code
- 30 Apr-2024
- 6.41 Kb
You can Share it:
Latest Code Pastes