klik untuk menyalin
👇
<?php
include 'db.php';
if($_SERVER['REQUEST_METHOD']=='POST'){
$pid = $_POST['product_id'];
$qty = $_POST['quantity'];
$res = $conn->query("SELECT * FROM products WHERE id='$pid'");
$p = $res->fetch_assoc();
$total = $p['price'] * $qty;
}
?>
<h1>Checkout</h1>
Produk: <?= $p['product_name']; ?><br>
Jumlah: <?= $qty; ?><br>
Total: Rp <?= $total; ?><br>
<form method="post" action="proses_order.php">
<input type="hidden" name="product_id" value="<?= $pid; ?>">
<input type="hidden" name="quantity" value="<?= $qty; ?>">
<input type="hidden" name="total" value="<?= $total; ?>">
Nama: <input type="text" name="customer_name"><br>
WA: <input type="text" name="customer_wa"><br>
Alamat: <input type="text" name="customer_adress"><br>
Payment: <input type="text" name="payment_metod"><br>
<button type="submit">Pesan</button>
</form>
Tidak ada komentar:
Posting Komentar