<?php
include 'fungsi.php';
global $total;
$id_pemesanan = $_GET['id'];
$query = mysqli_query($conn, "SELECT * FROM pemesanan INNER JOIN kamar ON pemesanan.id_kamar = kamar.id WHERE pemesanan.id = '$id_pemesanan'" );
while($row = mysqli_fetch_array($query)){
	$total = $total += ($row['jumlahpeserta'] * $row['harga']);
}
$bukti = $_FILES['gambar']['name'];

move_uploaded_file($_FILES['gambar']['tmp_name'], 'gambar/' .$bukti);

mysqli_query($conn, "INSERT INTO pembayaran VALUES('', '$id_pemesanan', '$total', '$bukti', '')");
header('Location: pembayaran.php?id='. $id_pemesanan);

?>