Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. <?php
  2. include 'koneksi.php';
  3. if (!isset($_SESSION['username']) and !isset($_SESSION['level'])){
  4. echo "<script>alert('Anda belum login'); window.location='halaman.php'</script>";
  5. exit();
  6. } elseif ($_SESSION['level']!="admin") {
  7. echo "<script>alert('Anda bukan admin'); window.location='halaman.php'</script>";
  8. exit();
  9. }
  10. ?>
  11. <h2>Pembayaran</h2>
  12. <div class="row">
  13. <div class="col-md-12">
  14. <table class="table table-bordered">
  15. <?php $id=$_GET['id']; ?>
  16. <?php $ambil=$koneksi->query("SELECT * FROM pembelian WHERE id_pembelian='$id'");?>
  17. <?php while ($pecah=$ambil->fetch_assoc()){ ?>
  18. <thead>
  19. <tr>
  20. <th>Nama</th>
  21. <td><?php echo $pecah['username']; ?></td>
  22. </tr>
  23. <tr>
  24. <th>Kode</th>
  25. <td><?php echo $pecah['kode']; ?></td>
  26. </tr>
  27. <tr>
  28. <th>Total</th>
  29. <td><?php echo $pecah['total_beli']; ?></td>
  30. </tr>
  31. <tr>
  32. <th>Tanggal</th>
  33. <td><?php echo $pecah['tanggal_bayar']; ?></td>
  34. </tr>
  35. </thead>
  36. <?php } ?>
  37. </table>
  38. </div>
  39. </div>
  40.  
  41. <form method="post">
  42. <div class="form-group">
  43. <label>No resi pengiriman</label>
  44. <input type="text" class="form-control" name="resi" autocomplete="off">
  45. </div>
  46. <div class="form-group">
  47. <input type="text" class="form-control" name="status" value="Barang dikirim" readonly>
  48. </div>
  49. <button class="btn btn-warning" name="proses">Proses</button>
  50. </form>
  51.  
  52. <?php if (isset($_POST['proses'])){
  53. $resi=$_POST['resi'];
  54. $status=$_POST['status'];
  55. $koneksi->query("UPDATE pembelian SET resi='$resi',status='$status' WHERE id_pembelian='$id'");
  56.  
  57. echo "<script>location='index.php?halaman=pembelian'</script>";
  58. } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement