Membuat Website Transaksi Tiket Pesawat dengan PHP Native
Pada kesempatan kali ini saya akan membuat Web Pembelian Tiket Pesawat dengan PHP.
Database:
relasi antar tabel |
tabel flight:
CREATE TABLE `flight` ( `flight_id` int(11) NOT NULL AUTO_INCREMENT, `maskapai` varchar(100) NOT NULL, `tanggal_penerbangan` date NOT NULL, `kuota` int(5) NOT NULL, `jam_kedatangan` time NOT NULL, `tujuan_akhir` varchar(100) NOT NULL, `sektor` varchar(100) NOT NULL, `harga` int(11) NOT NULL, `jam_berangkat` time NOT NULL, `jam_tiba` time NOT NULL, `bandara_asal` varchar(100) NOT NULL, `foto` varchar(100) NOT NULL, PRIMARY KEY (`flight_id`), KEY `flight_id` (`flight_id`) )
tabel user:
CREATE TABLE `user` ( `user_id` int(11) NOT NULL AUTO_INCREMENT, `nama` varchar(100) NOT NULL, `email` varchar(100) NOT NULL, `password` varchar(100) NOT NULL, `role` int(2) NOT NULL, PRIMARY KEY (`user_id`) )
tabel order:
CREATE TABLE `orders` (
`order_id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`kode_pnr` varchar(100) NOT NULL,
`tanggal` date NOT NULL,
`flight_id` int(11) NOT NULL,
`konfirmasi` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`order_id`),
KEY `flight_id` (`flight_id`),
KEY `user_id` (`user_id`),
KEY `user_id_2` (`user_id`),
KEY `flight_id_2` (`flight_id`),
CONSTRAINT `orders_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE CASCADE,
CONSTRAINT `orders_ibfk_2` FOREIGN KEY (`flight_id`) REFERENCES `flight` (`flight_id`) ON DELETE CASCADE ON UPDATE CASCADE
)
Code:
- Core(ini adalah code yang mendeklarasikan koneksi SQL dan juga function yang akan digunakan.)
<!-- libcore_backend.php -->
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
class Libcore
{
public $pdo = null;
/**
* Melakukan koneksi ke database
*/
function connect()
{
// Database credentials
$host = 'localhost'; // your database host
$username = 'root'; // your database username
$password = ''; // your database password
$database = 'tiket_pesawat'; // your database name
try {
$this->pdo = new PDO("mysql:host=$host;dbname=$database", $username, $password);
} catch (PDOException $e) {
die("Connection failed: " . $e->getMessage());
}
}
/**
*`
*/
function insertFlight($a, $file)
{
$sql = "INSERT INTO Flight (foto,maskapai, tanggal_penerbangan, kuota, bandara_asal, jam_kedatangan, tujuan_akhir, sektor, harga, jam_berangkat, jam_tiba)
VALUES (:foto, :maskapai, :tanggal_penerbangan, :kuota, :bandara_asal, :jam_kedatangan, :tujuan_akhir, :sektor, :harga, :jam_berangkat, :jam_tiba)";
// Prepare and execute the SQL statement
$stmt = $this->pdo->prepare($sql);
$stmt->bindParam(':maskapai', $a["maskapai"]);
$stmt->bindParam(':tanggal_penerbangan', $a["tanggal_penerbangan"]);
$stmt->bindParam(':kuota', $a["kuota"]);
$stmt->bindParam(':bandara_asal', $a["bandara_asal"]);
$stmt->bindParam(':jam_kedatangan', $a["jam_kedatangan"]);
$stmt->bindParam(':tujuan_akhir', $a["tujuan_akhir"]);
$stmt->bindParam(':sektor', $a["sektor"]);
$stmt->bindParam(':harga', $a["harga"]);
$stmt->bindParam(':jam_berangkat', $a["jam_berangkat"]);
$stmt->bindParam(':jam_tiba', $a["jam_tiba"]);
$namafoto = uniqid() . ".png";
$this->uploadFile($file, getcwd() . "/../public/foto/", $namafoto);
$stmt->bindParam(':foto', $namafoto);
return $stmt->execute();
}
function insertTicket($user_id, $kode_pnr, $tanggal, $flight_id)
{
$sql = "INSERT INTO Orders (user_id, kode_pnr, tanggal, flight_id) VALUES (:user_id, :kode_pnr, :tanggal, :flight_id) ";
// Prepare and execute the SQL statement
$stmt = $this->pdo->prepare($sql);
$stmt->bindParam(':user_id', $user_id);
$stmt->bindParam(':kode_pnr', $kode_pnr);
$stmt->bindParam(':tanggal', $tanggal);
$stmt->bindParam(':flight_id', $flight_id);
return $stmt->execute();
}
function deleteFlight($id)
{
$stmt = $this->pdo->prepare("DELETE FROM `Flight` WHERE `flight_id`=:id");
$stmt->bindParam(":id", $id);
return $stmt->execute();
}
function getTicket($user_id)
{
$stmt = $this->pdo->prepare("SELECT * FROM Orders INNER JOIN User INNER JOIN Flight ON Orders.user_id = User.user_id AND Flight.flight_id = Orders.flight_id WHERE Orders.user_id = :user_id");
$stmt->bindParam(":user_id", $user_id);
$stmt->execute();
return $stmt->fetchAll();
}
function getTicketList()
{
$stmt = $this->pdo->prepare("SELECT * FROM Orders INNER JOIN User INNER JOIN Flight ON Orders.user_id = User.user_id AND Flight.flight_id = Orders.flight_id");
$stmt->execute();
return $stmt->fetchAll();
}
function uploadFile($file, $targetDirectory, $nf)
{
$targetFile = $targetDirectory . $nf;
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($targetFile, PATHINFO_EXTENSION));
// Check if the file already exists
if (file_exists($targetFile)) {
return "Sorry, the file already exists.";
}
// Check file size (adjust as needed)
if ($file["size"] > 50000000) {
return "Sorry, your file is too large.";
}
// Allow certain file formats (you can customize this list)
$allowedExtensions = ["jpg", "jpeg", "png", "gif"];
if (!in_array($imageFileType, $allowedExtensions)) {
return "Sorry, only JPG, JPEG, PNG, and GIF files are allowed.";
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
return "Sorry, your file was not uploaded.";
} else {
// If everything is ok, try to upload the file
if (move_uploaded_file($file["tmp_name"], $targetFile)) {
return "The file " . htmlspecialchars(basename($file["name"])) . " has been uploaded.";
} else {
return "Sorry, there was an error uploading your file.";
}
}
}
function editFlight($a, $id)
{
$sql = "UPDATE Flight SET
maskapai = :maskapai,
tanggal_penerbangan = :tanggal_penerbangan,
kuota = :kuota,
bandara_asal = :bandara_asal,
jam_kedatangan = :jam_kedatangan,
tujuan_akhir = :tujuan_akhir,
sektor = :sektor,
harga = :harga,
jam_berangkat = :jam_berangkat,
jam_tiba = :jam_tiba
WHERE flight_id= :flight_id";
// Prepare and execute the SQL statement
$stmt = $this->pdo->prepare($sql);
$stmt->bindParam(':flight_id', $id);
$stmt->bindParam(':maskapai', $a["maskapai"]);
$stmt->bindParam(':tanggal_penerbangan', $a["tanggal_penerbangan"]);
$stmt->bindParam(':kuota', $a["kuota"]);
$stmt->bindParam(':bandara_asal', $a["bandara_asal"]);
$stmt->bindParam(':jam_kedatangan', $a["jam_kedatangan"]);
$stmt->bindParam(':tujuan_akhir', $a["tujuan_akhir"]);
$stmt->bindParam(':sektor', $a["sektor"]);
$stmt->bindParam(':harga', $a["harga"]);
$stmt->bindParam(':jam_berangkat', $a["jam_berangkat"]);
$stmt->bindParam(':jam_tiba', $a["jam_tiba"]);
return $stmt->execute();
}
function getFlightList()
{
$stmt = $this->pdo->prepare("SELECT * FROM `Flight`");
$stmt->execute();
return $stmt->fetchAll();
}
function getFlight($id)
{
$stmt = $this->pdo->prepare("SELECT * FROM `Flight` WHERE `flight_id`=:id");
$stmt->bindParam(":id", $id);
$stmt->execute();
return $stmt->fetch();
}
function getUser($email)
{
$stmt = $this->pdo->prepare("SELECT * FROM `User` WHERE `email`=:email");
$stmt->bindParam(":email", $email);
$stmt->execute();
return $stmt->fetch();
}
function loginUser($u, $p)
{
$stmt = $this->pdo->prepare("SELECT * FROM `User` WHERE `email`=:user AND `password`=:pass AND `role`=0");
$stmt->bindParam(':user', $u);
$stmt->bindParam(':pass', $p);
// Execute the statement
$stmt->execute();
// Fetch all rows as an associative array
$tickets = $stmt->fetch();
if (gettype($tickets) == "boolean") {
return false;
} else if (gettype($tickets) == "array" && count($tickets) > 0) {
setcookie("user", $u, time() + 3600);
setcookie('pass', $p, time() + 3600);
return count($tickets) > 0;
}
return false;
}
function loginStaff($u, $p)
{
$stmt = $this->pdo->prepare("SELECT * FROM `User` WHERE `email`=:user AND `password`=:pass AND `role`=1");
$stmt->bindParam(':user', $u);
$stmt->bindParam(':pass', $p);
// Execute the statement
$stmt->execute();
// Fetch all rows as an associative array
$tickets = $stmt->fetch();
if (gettype($tickets) == "boolean") {
return false;
} else if (gettype($tickets) == "array" && count($tickets) > 0) {
setcookie("user", $u, time() + 3600);
setcookie('pass', $p, time() + 3600);
return count($tickets) > 0;
}
return false;
}
function loginAdmin($u, $p)
{
$stmt = $this->pdo->prepare("SELECT * FROM `User` WHERE `email`=:user AND `password`=:pass AND `role`=2");
$stmt->bindParam(':user', $u);
$stmt->bindParam(':pass', $p);
// Execute the statement
$stmt->execute();
// Fetch all rows as an associative array
$tickets = $stmt->fetch();
if (gettype($tickets) == "boolean") {
return false;
} else if (gettype($tickets) == "array" && count($tickets) > 0) {
setcookie("user", "", time() - 3600, "/");
setcookie("pass", "", time() - 3600, "/");
setcookie("user", $u, time() + 3600);
setcookie('pass', $p, time() + 3600);
return count($tickets) > 0;
}
return false;
}
function registerUser($nama, $email, $pass)
{
$stmt = $this->pdo->prepare("INSERT INTO `User`(`nama`, `email`, `password`, role) VALUES (:nama, :email, :pass, 0) ");
$stmt->bindParam(':email', $email);
$stmt->bindParam(':nama', $nama);
$stmt->bindParam(':pass', $pass);
// Execute the statement
return $stmt->execute();
// Fetch all rows as an associative array
}
function confirmTicket($id)
{
$stmt = $this->pdo->prepare("UPDATE `Orders` SET `konfirmasi`=1 WHERE `order_id`=:order_id");
$stmt->bindParam(':order_id', $id);
// Execute the statement
return $stmt->execute();
// Fetch all rows as an associative array
}
function isUserLogin()
{
if (isset($_COOKIE["user"]) && isset($_COOKIE["pass"])) {
if (!$this->loginUser($_COOKIE["user"], $_COOKIE["pass"])) {
die("akun anda salah username atau password");
}
} else {
die("<script>alert('Anda belum login');window.location.href = 'login.php'</script>");
}
}
function isStaffLogin()
{
if (isset($_COOKIE["user"]) && isset($_COOKIE["pass"])) {
if (!$this->loginStaff($_COOKIE["user"], $_COOKIE["pass"])) {
die("<script>alert('Anda belum masuk sebagai petugas');window.location.href = 'login.php'</script>");
}
} else {
die("<script>alert('Anda belum login sebagai petugas');window.location.href = 'login.php'</script>");
}
}
function isAdminLogin()
{
if (isset($_COOKIE["user"]) && isset($_COOKIE["pass"])) {
if (!$this->loginAdmin($_COOKIE["user"], $_COOKIE["pass"])) {
die(var_dump($_COOKIE));
}
} else {
die("<script>alert('Anda belum login sebagai admin');window.location.href = 'login.php'</script>");
}
}
function logout()
{
setcookie("user", "", time() - 3600, "/");
setcookie("pass", "", time() - 3600, "/");
setcookie("user", "", time() - 3600);
setcookie("pass", "", time() - 3600);
setcookie("user", "", time() - 3600, "/admin");
setcookie("pass", "", time() - 3600, "/admin");
setcookie("user", "", time() - 3600, "/petugas");
setcookie("pass", "", time() - 3600, "/petugas");
}
}
User{
User adalah pelanggan yang membeli tiket.
<?php
include "./core/libcore_backend.php";
$core = new Libcore();
$core->connect();
$msg = '<div class="alert alert-warning p-2"><small>Masuk ke akun anda</small></div>';
if(isset($_POST["user"]) && isset($_POST["pass"])) {
if($core->loginUser($_POST["user"], $_POST["pass"])){
header("Location: index.php");
}
else {
$msg = '<div class="alert alert-danger p-2"><small>Email atau Passsword salah</small></div>';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ultravel - LOGIN</title>
<link href="./styles/bootstrap.min.css" rel="stylesheet">
<link href="./styles/styles.css" rel="stylesheet">
</head>
<body class="container" style="background-image: url(./image/ilustrasi-pesawat-lepas-landas-kereta-api-tapi-belum-vaksin-booster.jpeg); background-repeat: no-repeat;background-size: cover;">
<center>
<form class=" p-3" action="" style="max-width: 500px;border: 2px solid #eee;border-radius: 10px;margin-top: 25vh;background: rgba(0,0,0,0.8)" method="post">
<center><h3 class="mb-0" style="color: aliceblue;">ULTRAVEL</h3></center>
<small class="text" style="color: aliceblue;">Ultravel dulu, jalan-jalan kemudian</small>
<hr>
<?= $msg; ?>
<input class="form-control" placeholder="Email" name="user">
<input class="form-control mt-3" placeholder="Password" name="pass">
<button class="btn btn-success mt-3 w-100" style="color: aliceblue;">Login</button>
<hr>
<a href="register.php" style="color: aliceblue;">Klik untuk mendaftar akun</a>
</form>
</center>
</body>
</html>
- index
<?php
include "./core/libcore_backend.php";
$core = new Libcore();
$core->connect();
$core->isUserLogin();
$data = $core->getFlightList();
$x = $core->getUser($_COOKIE["user"]);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ultravel - RESERVASI PESAWAT</title>
<link href="./styles/bootstrap.min.css" rel="stylesheet">
<link href="./styles/styles.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color: rgba(60,160, 60,0.8);">
<div class="container-fluid ps-5">
<a class="navbar-brand" href="#">ULTRAVEL</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav w-100 ms-auto" style="float: right;">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Form Pemesanan</a>
</li>
<li class="nav-item w-75">
<a class="nav-link" aria-current="page" href="pesanan.php">Tiket Saya</a>
</li>
<li class="nav-item dropdown" style="margin-left: 3%;">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<?= $x["nama"] ?>
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="logout.php">Logout</a></li>
<li><a class="dropdown-item" href="admin/login.php">Login Admin</a></li>
<li><a class="dropdown-item" href="petugas/login.php">Login Staff</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<div class="container mt-5 d-flex">
<?php foreach ($data as $flight) : ?>
<div class="col-md-3 mb-4 h-50 m-1">
<div class="card" style="height: 550px;">
<div class="card-body">
<img src="./public/foto/<?= $flight['foto']; ?>" class="card-img-top" alt="..." height="250">
<h5 class="card-title mb-0"><?= $flight['maskapai'] ?> #<?= $flight['flight_id'] ?></h5>
<p class="text-muted mb-3 h6"><?= $flight['bandara_asal'] ?> - <?= $flight['tujuan_akhir'] ?></p>
Jam Penerbangan: <?= $flight['tanggal_penerbangan'] ?><br>
Quota: <?= $flight['kuota'] ?><br>
<!-- Add other data fields as needed -->
<!-- Example: -->
Sektor: <?= $flight['sektor'] ?><br>
Waktu Kedatangan: <?= $flight['jam_kedatangan'] ?>
</p>
<!-- Add more fields as needed -->
<form method="post" action="booking.php">
<input name="id" value="<?= $flight['flight_id'] ?>" type="hidden">
<hr>
<small class="text-muted">harga: Rp<?= $flight['harga'] ?></small>
<button class="btn btn-success w-100">Pesan Tiket</a>
</form>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<script src="./styles/bootstrap.bundle.min.js"></script>
</body>
</html>
- booking
<?php
include "./core/libcore_backend.php";
$core = new Libcore();
$core->connect();
$core->isUserLogin();
$x = $core->getUser($_COOKIE["user"]);
if (isset($_POST["id"])) {
$f = $core->getFlight($_POST["id"]);
}
$arr = [];
$tickets = [];
$kode_pnr = uniqid();
$date = new DateTime("now");
$core->insertTicket(
intval($x["user_id"]),
$kode_pnr,
$date->format("Y-m-d"),
$_POST["id"]
);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ultravel - RESERVASI PESAWAT</title>
<link href="./styles/bootstrap.min.css" rel="stylesheet">
<link href="./styles/styles.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color: rgba(60,160, 60,0.8);">
<div class="container-fluid ps-5">
<a class="navbar-brand" href="#">ULTRAVEL</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav w-100 ms-auto" style="float: right;">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Form Pemesanan</a>
</li>
<li class="nav-item w-75">
<a class="nav-link" aria-current="page" href="pesanan.php">Tiket Saya</a>
</li>
<li class="nav-item dropdown" style="margin-left: 3%;">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<?= $x["nama"] ?>
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="#">Logout</a></li>
<li><a class="dropdown-item" href="admin/login.php">Login Staff</a></li>
<li><a class="dropdown-item" href="petugas/login.php">Login Admin</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<div class="container mt-5">
<center>
<h4>Pemesanan selesai</h4>
</center>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Maskapai</th>
<th>Tujuan</th>
<th>Sektor</th>
<th>Tanggal Penerbangan</th>
<th>Jam Kedatangan</th>
<th>Jam Keberangkatan</th>
<th>Jam Tiba</th>
<th>Kode PNR</th>
<th>Harga</th>
</tr>
</thead>
<tbody>
<tr>
<td><?= $f["maskapai"] ?></td>
<td><?= $f["bandara_asal"] ?> - <?= $f["tujuan_akhir"] ?> </td>
<td><?= $f["sektor"] ?></td>
<td><?= $f["tanggal_penerbangan"] ?></td>
<td><?= $f["jam_kedatangan"] ?></td>
<td><?= $f["jam_berangkat"] ?></td>
<td><?= $f["jam_tiba"] ?></td>
<td><?= $kode_pnr; ?></td>
<td><?= $f["harga"] ?></td>
</tr>
</tbody>
</table>
<center><a class="btn btn-success" href="pesanan.php">cek status konfirmasi tiket</a></center>
</div>
</body>
</html>
- pesanan
<?php
include "./core/libcore_backend.php";
$core = new Libcore();
$core->connect();
$core->isUserLogin();
$x = $core->getUser($_COOKIE["user"]);
$data = $core->getTicket($x["user_id"]);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ultravel - RESERVASI PESAWAT</title>
<link href="./styles/bootstrap.min.css" rel="stylesheet">
<link href="./styles/styles.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color: rgba(60,160, 60,0.8);">
<div class="container-fluid ps-5">
<a class="navbar-brand" href="#">ULTRAVEL</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav w-100 ms-auto" style="float: right;">
<li class="nav-item">
<a class="nav-link" aria-current="page" href="index.php">Form Pemesanan</a>
</li>
<li class="nav-item w-75">
<a class="nav-link active" aria-current="page" href="pesanan.php">Tiket Saya</a>
</li>
<li class="nav-item dropdown" style="margin-left: 3%;">
<a class="nav-link active dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<?= $x["nama"] ?>
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="#">Logout</a></li>
<li><a class="dropdown-item" href="admin/login.php">Login Adminf</a></li>
<li><a class="dropdown-item" href="petugas/login.php">Login Staff</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<div class="container mt-5 ">
<h4 class="text-muted">User Area > Ticket Status</h4>
<table class="table table-sm table-striped table-bordered">
<thead>
<tr>
<th>Maskapai</th>
<th>Tujuan</th>
<th>Sektor</th>
<th>Tanggal Penerbangan</th>
<th>Jam Kedatangan</th>
<th>Jam Keberangkatan</th>
<th>Jam Tiba</th>
<th>Kode PNR</th>
<th>Harga</th>
<th>Konfirmasi</th>
</tr>
</thead>
<tbody>
<tr>
<?php
foreach ($data as $f) :
?>
<td><?= $f["maskapai"] ?></td>
<td><?= $f["bandara_asal"] ?> - <?= $f["tujuan_akhir"] ?> </td>
<td><?= $f["sektor"] ?></td>
<td><?= $f["tanggal_penerbangan"] ?></td>
<td><?= $f["jam_kedatangan"] ?></td>
<td><?= $f["jam_berangkat"] ?></td>
<td><?= $f["jam_tiba"] ?></td>
<td><?= $f["kode_pnr"]; ?></td>
<td><?= $f["harga"] ?></td>
<td><?= $f["konfirmasi"] == 0 ? "<small class='text-danger'>belum</small>" : "<a class='btn btn-sm btn-success'>Cetak tiket</a>"; ?></td>
</tr>
<?php
endforeach;
?>
</tbody>
</table>
</div>
<script src="./styles/bootstrap.bundle.min.js"></script>
</body>
</html>
<?php
include "./core/libcore_backend.php";
$core = new Libcore();
$core->connect();
if(isset($_POST["nama"]) && isset($_POST["email"]) && isset($_POST["pass"])) {
$x = $core->registerUser($_POST["nama"], $_POST["email"], $_POST["pass"]);
if($x){
$msg = '<div class="alert alert-success p-2"><small>Akun telah dibuat </small></div>';
}
else {
if($x){
$msg = '<div class="alert alert-success p-2"><small>Akun gagal dibuat </small></div>';
}
}
}
$msg = '<div class="alert alert-warning p-2"><small>Registrasi Akun</small></div>';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ultravel - DAFTAR</title>
<link href="./styles/bootstrap.min.css" rel="stylesheet">
<link href="./styles/styles.css" rel="stylesheet">
</head>
<body class="container" style="background-image: url(./image/ilustrasi-pesawat-lepas-landas-kereta-api-tapi-belum-vaksin-booster.jpeg); background-repeat: no-repeat;background-size: cover;">
<center>
<form class=" p-3" action="" style="max-width: 500px;border: 2px solid #eee;border-radius: 10px;margin-top: 20vh;background: rgba(0,0,0,0.8)" method="post">
<center><h3 class="mb-0" style="color: aliceblue;">ULTRAVEL</h3></center>
<small class="text" style="color: aliceblue">Ultravel dulu, jalan-jalan kemudian</small>
<hr>
<?= $msg; ?>
<input class="form-control mt-3 w-100" placeholder="Nama" name="nama">
<div class="d-flex justify-content-start" style><small class="text" style="text-align: start; color: aliceblue;">Masukkan nama lengkap anda</small></div>
<input class="form-control mt-3" placeholder="Email" name="email" type="email">
<div class="d-flex justify-content-start"><small class="text" style="text-align: start; color: aliceblue;">Masukkan email yang valid <!--(harus memiliki simbol '@')--></small></div>
<input class="form-control mt-3" placeholder="Password" name="pass">
<div class="d-flex justify-content-start"><small class="text" style="text-align: start; color: aliceblue;">Masukkan password yang ingin digunakan</small></div>
<button class="btn btn-success mt-3 w-100">Register</button>
</form>
</center>
</body>
</html>
}
Petugas{
Petugas adalah role yang bertugas untuk meng-konfirmasi pesanan.
<?php
include "./../core/libcore_backend.php";
$core = new Libcore();
$core->connect();
$msg = '<div class="alert alert-warning p-2"><small>Masuk ke akun staff</small></div>';
if(isset($_POST["user"]) && isset($_POST["pass"])) {
if($core->loginStaff($_POST["user"], $_POST["pass"])){
header("Location: petugas.php");
}
else {
$msg = '<div class="alert alert-danger p-2"><small>Email atau Passsword salah</small></div>';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ultravel - LOGIN</title>
<link href="./../styles/bootstrap.min.css" rel="stylesheet">
<link href="./../styles/styles.css" rel="stylesheet">
</head>
<body class="container" style="background-image: url(./../image/e9160500-ec2b-41a0-80f6-4da3b67ac209_169.jpg); background-repeat: no-repeat;background-size: cover;">
<center>
<form class=" p-3" action="" style="max-width: 500px;border: 2px solid #eee;border-radius: 10px;margin-top: 25vh;background: rgba(0,0,0,0.8)" method="post">
<center><h3 class="mb-0" style="color: aliceblue;">ULTRAVEL </h3></center>
<small class="text" style="color: aliceblue;">Ultravel dulu, jalan-jalan kemudian</small>
<hr>
<?= $msg; ?>
<input class="form-control" placeholder="Email" name="user">
<input class="form-control mt-3" placeholder="Password" name="pass">
<button class="btn btn-success mt-3 w-100" style="color: aliceblue;">Login</button>
</form>
</center>
</body>
</html>
- petugas
<?php
include "./../core/libcore_backend.php";
$core = new Libcore();
$core->connect();
$core->isStaffLogin();
$x = $core->getUser($_COOKIE["user"]);
if(isset($_GET["confirm"])){
$core->confirmTicket(intval( $_GET["confirm"]));
}
$data = $core->getTicketList();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ultravel - STAFF AREA</title>
<link href="./../styles/bootstrap.min.css" rel="stylesheet">
<link href="./../styles/styles.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color: rgba(60,50, 60,0.8);">
<div class="container-fluid ps-5">
<a class="navbar-brand" href="#">ULTRAVEL<small><i>staff</i></small></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav w-100 ms-auto" style="float: right;">
<li class="nav-item" style="width: 85%;">
<a class="nav-link active" aria-current="page" href="petugas.php">Konfirmasi Tiket</a>
</li>
<li class="nav-item dropdown" style="margin-left: 3%;">
<a class="nav-link active dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<?= $x["nama"] ?>
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="./../logout.php">Logout</a></li>
<li><a class="dropdown-item" href="./../admin/login.php">Login to Admin</a></li>
<li><a class="dropdown-item" href="./../petugas/login.php">Login to Staff</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<div class="container mt-4 ">
<h4 class="text-muted">Staff Area > Ticket Confirmation</h4>
<table class="table table-sm table-striped table-bordered">
<thead>
<tr>
<th>Atas nama</th>
<th>Maskapai</th>
<th>Tgl. Dipesan</th>
<th>Tujuan</th>
<th>Sektor</th>
<th>Tgl. Penerbangan</th>
<th>Jam Kedatangan</th>
<th>Jam Keberangkatan</th>
<th>Jam Tiba</th>
<th>Kode PNR</th>
<th>Harga</th>
<th>Konfirmasi</th>
</tr>
</thead>
<tbody>
<tr>
<?php
foreach ($data as $f) :
?>
<td><?= $f["nama"] ?></td>
<td><?= $f["maskapai"] ?></td>
<td><?= $f["tanggal"] ?></td>
<td><?= $f["bandara_asal"] ?> - <?= $f["tujuan_akhir"] ?> </td>
<td><?= $f["sektor"] ?></td>
<td><?= $f["tanggal_penerbangan"] ?></td>
<td><?= $f["jam_kedatangan"] ?></td>
<td><?= $f["jam_berangkat"] ?></td>
<td><?= $f["jam_tiba"] ?></td>
<td><?= $f["kode_pnr"]; ?></td>
<td><?= $f["harga"] ?></td>
<td><?= $f["konfirmasi"] == 0 ? "<a class='btn btn-sm btn-success' href='?confirm=".$f['order_id']."'>konfirmasi</a>" : "<small class='text-muted'>sudah digunakan</small>"; ?></td>
</tr>
<?php
endforeach;
?>
</tbody>
</table>
</div>
<script src="./../styles/bootstrap.bundle.min.js"></script>
</body>
</html>
}
Admin{
Admin adalah role yang bertugas untuk menambahkan atau mengubah tiket yang akan dijual.
<?php
include "./../core/libcore_backend.php";
$core = new Libcore();
$core->connect();
$msg = '<div class="alert alert-warning p-2"><small>Masuk ke akun Admin</small></div>';
if(isset($_POST["user"]) && isset($_POST["pass"])) {
if($core->loginAdmin($_POST["user"], $_POST["pass"])){
header("Location: data_penerbangan.php");
}
else {
$msg = '<div class="alert alert-danger p-2"><small>Email atau Passsword salah</small></div>';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ultravel - LOGIN</title>
<link href="./../styles/bootstrap.min.css" rel="stylesheet">
<link href="./../styles/styles.css" rel="stylesheet">
</head>
<body class="container" style="background-image: url(./../image/e9160500-ec2b-41a0-80f6-4da3b67ac209_169.jpg); background-repeat: no-repeat;background-size: cover;">
<center>
<form class=" p-3" action="" style="max-width: 500px;border: 2px solid #eee;border-radius: 10px;margin-top: 25vh;background: rgba(0,0,0,0.8)" method="post">
<center><h3 class="mb-0" style="color: aliceblue;">ULTRAVEL </h3></center>
<small class="text" style="color: aliceblue;">Ultravel dulu, jalan-jalan kemudian</small>
<hr>
<?= $msg; ?>
<input class="form-control" placeholder="Email" name="user">
<input class="form-control mt-3" placeholder="Password" name="pass">
<button class="btn btn-success mt-3 w-100" style="color: aliceblue;">Login</button>
</form>
</center>
</body>
</html>
- data penerbangan
<?php
include "./../core/libcore_backend.php";
$core = new Libcore();
$core->connect();
$core->isAdminLogin();
if(isset($_GET["del"])){
if($core->deleteFlight($_GET["del"])) echo "<script>alert('Data telah dihapus')</script>";
}
$data = $core->getFlightList();
$x = $core->getUser($_COOKIE["user"]);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ultravel - RESERVASI PESAWAT</title>
<link href="./../styles/bootstrap.min.css" rel="stylesheet">
<link href="./../styles/styles.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color: rgba(0,0, 0,0.8);">
<div class="container-fluid ps-5">
<a class="navbar-brand" href="#">ULTRAVEL<small><i>staff</i></small></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav w-100 ms-auto" style="float: right;">
<li class="nav-item" >
<a class="nav-link active" aria-current="page" href="data_penerbangan.php">Data</a>
</li>
<li class="nav-item" style="width: 85%;">
<a class="nav-link" aria-current="page" href="tambah_penerbangan.php">Tambah Penerbangan</a>
</li>
<li class="nav-item dropdown" style="margin-left: 3%;">
<a class="nav-link active dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<?= $x["nama"] ?>
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="./../logout.php">Logout</a></li>
<li><a class="dropdown-item" href="./../admin/login.php">Login to Admin</a></li>
<li><a class="dropdown-item" href="./../petugas/login.php">Login to Staff</a></li>
</ul>
</li>
</ul>
</div>
</div></nav>
<div class="container mt-5">
<h2>Flight Data</h2>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Maskapai</th>
<th>Tanggal Penerbangan</th>
<th>Kuota</th>
<th>Bandara Asal</th>
<th>Jam Kedatangan</th>
<th>Tujuan Akhir</th>
<th>Sektor</th>
<th>Harga</th>
<th>Jam Berangkat</th>
<th>Jam Tiba</th>
<th>Image</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($data as $flight) : ?>
<tr>
<td><?= strval($flight['maskapai']); ?></td>
<td><?= strval( $flight['tanggal_penerbangan']); ?></td>
<td><?= strval( $flight['kuota']); ?></td>
<td><?= $flight['bandara_asal']; ?></td>
<td><?= $flight['jam_kedatangan']; ?></td>
<td><?= $flight['tujuan_akhir']; ?></td>
<td><?= $flight['sektor']; ?></td>
<td><?= $flight['harga']; ?></td>
<td><?= $flight['jam_berangkat']; ?></td>
<td><?= $flight['jam_tiba']; ?></td>
<td><img src="./../public/foto/<?= $flight['foto']; ?>" width="100" height="100"> </td>
<td><a class="btn btn-success btn-sm m-1" href="edit_penerbangan.php?id=<?= $flight['flight_id']; ?>">Edit</a><a class="btn btn-danger btn-sm m-1" href="?del=<?= $flight['flight_id'] ?>">Hapus</a></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<script src="./../styles/bootstrap.bundle.min.js"></script>
</div>
</body>
</html>
- tambah penerbangan
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
include "./../core/libcore_backend.php";
$core = new Libcore();
$core->connect();
$core->isAdminLogin();
$msg = "";
$x = $core->getUser($_COOKIE["user"]);
if (isset($_POST["maskapai"])) {
if ($core->insertFlight($_POST, $_FILES["foto"]))
$msg = '<div class="alert alert-success p-2"><small>Data penerbangan telah dibuat </small></div>';
else
$msg = '<div class="alert alert-success p-2"><small>Data penerbangan gagal dibuat </small></div>';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ultravel - RESERVASI PESAWAT</title>
<link href="./../styles/bootstrap.min.css" rel="stylesheet">
<link href="./../styles/styles.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color: rgba(0,0, 0,0.8);">
<div class="container-fluid ps-5">
<a class="navbar-brand" href="#">ULTRAVEL<small><i>staff</i></small></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav w-100 ms-auto" style="float: right;">
<li class="nav-item">
<a class="nav-link" aria-current="page" href="data_penerbangan.php">Data</a>
</li>
<li class="nav-item" style="width: 85%;">
<a class="nav-link active" aria-current="page" href="tambah_penerbangan.php">Tambah Penerbangan</a>
</li>
<li class="nav-item dropdown" style="margin-left: 3%;">
<a class="nav-link active dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<?= $x["nama"] ?>
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="./../logout.php">Logout</a></li>
<li><a class="dropdown-item" href="./../admin/login.php">Login to Admin</a></li>
<li><a class="dropdown-item" href="./../petugas/login.php">Login to Staff</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<div class="container mt-3">
<h3 class="text-muted">Admin area > Tambah Penerbangan</h3>
<div class="container p-3" style="border: 2px solid #eee;border-radius: 10px">
<?= $msg ?>
<form method="post" action="tambah_penerbangan.php" enctype="multipart/form-data">
<!-- Dropdown for Maskapai -->
<div class="mb-3">
<label for="maskapai" class="form-label">Maskapai</label>
<select class="form-select" id="maskapai" name="maskapai" required>
<option value="garuda_indonesia">Garuda Indonesia</option>
<option value="ncek_air">Ncek Air</option>
<option value="etihad">Etihad</option>
</select>
</div>
<!-- Date input for Tanggal Penerbangan -->
<div class="mb-3">
<label for="tanggal_penerbangan" class="form-label">Tanggal Penerbangan</label>
<input type="date" class="form-control" id="tanggal_penerbangan" name="tanggal_penerbangan" required>
</div>
<!-- Number input for Kuota -->
<div class="mb-3">
<label for="kuota" class="form-label">Kuota</label>
<input type="number" class="form-control" id="kuota" name="kuota" required>
</div>
<!-- Time input for Jam Kedatangan -->
<div class="mb-3">
<label for="jam_kedatangan" class="form-label">Jam Kedatangan</label>
<input type="time" class="form-control" id="jam_kedatangan" name="jam_kedatangan" required>
</div>
<!-- Text input for bandara asal -->
<div class="mb-3">
<label for="tujuan_akhir" class="form-label">Bandara Asal</label>
<input type="text" class="form-control" id="bandara_asal" name="bandara_asal" required>
</div>
<!-- Text input for Tujuan Akhir -->
<div class="mb-3">
<label for="tujuan_akhir" class="form-label">Tujuan</label>
<input type="text" class="form-control" id="tujuan_akhir" name="tujuan_akhir" required>
</div>
<!-- Text input for Sektor -->
<div class="mb-3">
<label for="sektor" class="form-label">Sektor</label>
<input type="text" class="form-control" id="sektor" name="sektor" required>
</div>
<!-- Number input for Harga -->
<div class="mb-3">
<label for="harga" class="form-label">Harga</label>
<input type="number" class="form-control" id="harga" name="harga" required>
</div>
<!-- Time input for Jam Berangkat -->
<div class="mb-3">
<label for="jam_berangkat" class="form-label">Jam Berangkat</label>
<input type="time" class="form-control" id="jam_berangkat" name="jam_berangkat" required>
</div>
<!-- Time input for Jam Tiba -->
<div class="mb-3">
<label for="jam_tiba" class="form-label">Jam Tiba</label>
<input type="time" class="form-control" id="jam_tiba" name="jam_tiba" required>
</div>
<div class="mb-3">
<label for="jam_tiba" class="form-label">Foto</label>
<input type="file" class="form-control" id="foto" name="foto" required>
</div>
<!-- Submit button -->
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
<script src="./../styles/bootstrap.bundle.min.js"></script>
</body>
</html>
- edit penerbangan
<?php
include "./../core/libcore_backend.php";
$core = new Libcore();
$core->connect();
$core->isAdminLogin();
$f = $core->getFlight($_GET["id"]);
$msg = "";
if (isset($_POST["maskapai"]) && isset($_GET["edit"])) {
if ($core->editFlight($_POST, $_GET["id"]))
$msg = '<div class="alert alert-success p-2"><small>Data telah di edit </small></div>';
else
$msg = '<div class="alert alert-success p-2"><small>Data gagal di edit </small></div>';
}
$x = $core->getUser($_COOKIE["user"]);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ultravel - RESERVASI PESAWAT</title>
<link href="./../styles/bootstrap.min.css" rel="stylesheet">
<link href="./../styles/styles.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark" style="background-color: rgba(0,0, 0,0.8);">
<div class="container-fluid ps-5">
<a class="navbar-brand" href="#">ULTRAVEL<small><i>staff</i></small></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav w-100 ms-auto" style="float: right;">
<li class="nav-item" >
<a class="nav-link active" aria-current="page" href="data_penerbangan.php">Data</a>
</li>
<li class="nav-item" style="width: 85%;">
<a class="nav-link" aria-current="page" href="tambah_penerbangan.php">Tambah Penerbangan</a>
</li>
<li class="nav-item dropdown" style="margin-left: 3%;">
<a class="nav-link active dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<?= $x["nama"] ?>
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="./../logout.php">Logout</a></li>
<li><a class="dropdown-item" href="./../admin/login.php">Login to Admin</a></li>
<li><a class="dropdown-item" href="./../petugas/login.php">Login to Staff</a></li>
</ul>
</li>
</ul>
</div>
</div></nav>
<div class="container mt-5">
<div class="container mt-5 m-5 p-3" style="border: 2px solid #eee;border-radius: 10px">
<h2>Edit Penerbangan</h2>
<?= $msg ?>
<form method="post" action="edit_penerbangan.php?id=<?= $_GET['id'] ?>&edit=true">
<!-- Dropdown for Maskapai -->
<div class="mb-3">
<label for="maskapai" class="form-label">Maskapai</label>
<select class="form-select" id="maskapai" name="maskapai" required>
<option value="ryan_air" <?= $f["maskapai"] == 'ryan_air' ? 'selected' :'' ?>>Ryan Air</option>
<option value="batik_air" <?= $f["maskapai"] == 'batik_air' ? 'selected' :'' ?>>Batik Air</option>
<option value="easyjet" <?= $f["maskapai"] == 'easyjet' ? 'selected' :'' ?>>EasyJet</option>
</select>
</div>
<!-- Date input for Tanggal Penerbangan -->
<div class="mb-3">
<label for="tanggal_penerbangan" class="form-label">Tanggal Penerbangan</label>
<input type="date" class="form-control" id="tanggal_penerbangan" name="tanggal_penerbangan" value="<?= $f["tanggal_penerbangan"] ?>" required>
</div>
<!-- Number input for Kuota -->
<div class="mb-3">
<label for="kuota" class="form-label">Kuota</label>
<input type="number" class="form-control" id="kuota" name="kuota" value="<?= $f["kuota"] ?>" required>
</div>
<!-- Time input for Jam Kedatangan -->
<div class="mb-3">
<label for="jam_kedatangan" class="form-label">Jam Kedatangan</label>
<input type="time" class="form-control" id="jam_kedatangan" name="jam_kedatangan" value="<?= $f["jam_kedatangan"] ?>" required>
</div>
<!-- Text input for bandara asal -->
<div class="mb-3">
<label for="tujuan_akhir" class="form-label">Bandara Asal</label>
<input type="text" class="form-control" id="bandara_asal" value=" <?= $f["bandara_asal"] ?>" name="bandara_asal" required>
</div>
<!-- Text input for Tujuan Akhir -->
<div class="mb-3">
<label for="tujuan_akhir" class="form-label">Tujuan</label>
<input type="text" class="form-control" id="tujuan_akhir" name="tujuan_akhir" value=" <?= $f["tujuan_akhir"] ?>" required>
</div>
<!-- Text input for Sektor -->
<div class="mb-3">
<label for="sektor" class="form-label">Sektor</label>
<input type="text" class="form-control" id="sektor" name="sektor" value=" <?= $f["sektor"] ?>" required>
</div>
<!-- Number input for Harga -->
<div class="mb-3">
<label for="harga" class="form-label">Harga</label>
<input type="number" class="form-control" id="harga" name="harga" value= <?= strval($f["harga"]) ?> required>
</div>
<!-- Time input for Jam Berangkat -->
<div class="mb-3">
<label for="jam_berangkat" class="form-label">Jam Berangkat</label>
<input type="time" class="form-control" id="jam_berangkat" name="jam_berangkat" value="<?= $f["jam_berangkat"] ?>"required>
</div>
<!-- Time input for Jam Tiba -->
<div class="mb-3">
<label for="jam_tiba" class="form-label">Jam Tiba</label>
<input type="time" class="form-control" id="jam_tiba" name="jam_tiba" value="<?= $f["jam_tiba"] ?>" required>
</div>
<!-- Submit button -->
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
<script src="./../styles/bootstrap.bundle.min.js"></script>
</body>
</html>
}
Jangan lupa membuat folder image seperti di bawah
Comments
Post a Comment