fungsi pemesanan

parent 1a21e489
......@@ -16,7 +16,7 @@
if (isset($_SESSION['items'])) {
foreach ($_SESSION['items'] as $key => $val) {
$query = mysqli_query($koneksi, "SELECT * FROM t_buku WHERE isbn = '$key'");
$data = mysqli_fetch_array($query);
$data = mysqli_fetch_array($query);
$jumlah_harga = $data['harga'] * $val;
$total += $jumlah_harga;
......@@ -33,6 +33,12 @@
<?php
}
?>
<form action="savebook_process.php" method="POST">
<input type="hidden" name="id_user" value="<?php $_GET['id_user'];?>">
<input type="hidden" name="isbn" value="<?php $_GET['isbn'];?>">
<input type="hidden" name="total" value="<?php $_GET['total'];?>">
<input type="submit" name="pesan" value="Pesan Sekarang">
</form>
</div>
<div class="col-md-8">
Pembayaran dapat dilakukan dengan menghubungi kontak dibawah ini :
......
<?php
session_start();
include 'koneksi.php';
$user = $_POST['id_user'];
$buku = $_POST['isbn'];
$total = $_POST['total'];
$tambah = mysqli_query($koneksi, "INSERT INTO t_pemesanan VALUES('$buku', '$user', '$total', NOW())");
if($tambah) {
echo "<script>alert('Data pesanan berhasil disimpan'); window.location = 'savebook.php'</script>";
}
else {
echo "<script>alert('Gagal menyimpan pesanan !'); window.location = 'checkout.php'</script>";
}
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment