/
book.php
49 lines (46 loc) · 1.32 KB
/
book.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!-- CSS -->
<script src="js/sweetalert-dev.js"></script>
<link rel="stylesheet" href="css/sweetalert.css">
<link href="css/custom.css" type="text/css" rel="stylesheet">
</head>
<body>
<?php
session_start();
require_once "connect.php";
require_once "functionbook.php";
$id_book = IdKredit(autoID());
$_SESSION['id_book'] = $id_book;
$nopol = $_POST['nopol'];
$jam = $_POST['jam'];
$query = "INSERT INTO booking (id_book,tanggal,ktp,nopol,jam,status) VALUES ('$id_book',now(),'".$_SESSION['ktp']."','$nopol','$jam','pending')";
if (mysqli_query($db, $query)) {
echo "<script>
swal({
title: \"Sukses!\",
text: \"Booking sukses\",
type: \"success\"
},
function () {
window.location.href = 'home.php';
});
</script>";
exit();
} else { echo "<script>
swal({
title: \"Gagal!\",
text: \"Booking gagal\",
type: \"error\"
},
function () {
window.location.href = 'home.php';
});
</script>";
}
mysqli_close($db);
?>
</body>
</html>