-
Notifications
You must be signed in to change notification settings - Fork 0
/
detail.php
67 lines (57 loc) · 1.71 KB
/
detail.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
//error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
session_start();
include 'date.php';
include 'koneksi.php';
$id_produk = $_GET["id"];
$ambil = $koneksi->query("SELECT * FROM produk WHERE id_produk='$id_produk'");
$detail = $ambil->fetch_assoc();
?>
<!DOCTYPE html>
<html>
<head>
<title>Detail Produk</title>
<link rel="stylesheet" type="text/css" href="admin/assets/css/bootstrap.css">
</head>
<body>
<!-- navbar -->
<?php include 'navbar.php'; ?>
<section class="konten">
<div class="container">
<div class="row">
<div class="col-md-3">
<div class="thumbnail">
<img src="foto_produk/<?php echo $detail["foto_produk"]; ?>" class="img-responsive">
</div>
</div>
<div class="col-md-4">
<h4><?php echo $detail["nama_produk"]; ?></h4>
<h5>Rp <?php echo number_format($detail["harga_produk"]); ?></h5>
<h5>Stok : <?php echo $detail["stok_produk"]; ?></h5>
<form method="POST">
<div class="form-group">
<div class="input-group">
<input type="number" min="1" class="form-control" name="jumlah" max="<?php echo $detail["stok_produk"]; ?>" required>
<div class="input-group-btn">
<button class="btn btn-primary" name="beli">Beli</button>
</div>
</div>
</div>
</form>
<?php
if (isset($_POST["beli"]))
{
$jumlah = $_POST["jumlah"];
$_SESSION["keranjang"][$id_produk] += $jumlah;
echo "<script>alert('Dimasukkan ke keranjang.');</script>";
echo "<script>location='keranjang.php'</script>";
}
?>
<h4>Deskripsi Produk</h4>
<p><?php echo $detail["deskripsi_produk"]; ?></p>
</div>
</div>
</div>
</section>
</body>
</html>