Upload New File

parent c50146b4
<?php
session_start();
include('../config.php');
include("template/header.php");
include("../common/function.php");
include("functions.php");
// include("../common/dbconfig.php");
open_page("Pesan Tiket");
if(! isset($_SESSION['is_login']))
{
header('location:../index.php');
}
if (!isset($_SESSION["username"])){
// echo "<script>alert('Login terlebih dahulu');window.location='../index.php';</script>";
// exit;
echo "Anda harus login dulu <br><a href='../index.php'>Klik disini</a>";
exit;
}
$role = $_SESSION["role"];
if($role != "user"){
echo "<script>alert('Anda bukan user');window.location='../index.php';</script>";
exit;
}
$id_akun = $_SESSION["id_akun"];
$nama = $_SESSION["nama"];
$username = $_SESSION["username"];
$id = $_GET["id"];
// kita query
$pesan_tiket = query("SELECT t_tiketsdia.id, t_tiketsdia.kode_tiket, destinasi.nama_destinasi,destinasi.id_destinasi, pt_trans.nama_transp, t_tiketsdia.harga, pt_kategori.nama_kategori,pt_trans.id_transp
FROM pt_kategori INNER JOIN (pt_trans INNER JOIN (destinasi INNER JOIN t_tiketsdia ON destinasi.id_destinasi = t_tiketsdia.t_destinasi) ON pt_trans.id_transp = t_tiketsdia.t_kendaraan) ON pt_kategori.id_kategori = pt_trans.kategori_id
WHERE id = $id")[0];
if(isset($_POST["submit"]))
{
if(beli($_POST) > 0)
{
echo
"
<script>
alert('Berhasil dibeli');
document.location.href = 'tiket_user.php';
</script>
";
}else{
echo
"
<script>
alert('Gagal dibeli');
document.location.href = 'tiket_user.php';
</script>
";
}
}
?>
<!-- ======= Breadcrumbs ======= -->
<section id="breadcrumbs" class="breadcrumbs">
<div class="container">
<div class="d-flex justify-content-between align-items-center">
<h2>Pesan Tiket</h2>
</div>
</div>
</section>
<!-- End Breadcrumbs -->
<div class="modal-dialog" role="document">
<div class="modal-content border-success">
<div class="modal-header border-danger">
<h2>Formulir Pesan Tiket</h2><br>
</div>
<div class="modal-body">
<form action="" method="post">
<input type="hidden" name="id_tiket" value="<?= $pesan_tiket['id']?>" >
<input type="hidden" name="id_akun" value="<?=$id_akun?>" >
<div class="form-group">
<label for="nama_destinasi">Tujuan: </label> <label for="nama_destinasi"><?= $pesan_tiket['nama_destinasi']?></label>
<input type="hidden" name="id_destinasi" value="<?= $pesan_tiket['id_destinasi']?>" >
</div>
<div class="form-group">
<label for="nama_transp">Transportasi: <?= $pesan_tiket['nama_transp']?></label>
<input type="hidden" name="id_transp" value="<?= $pesan_tiket['id_transp']?>" >
</div>
<div class="form-group">
<label for="harga">Harga: Rp.<?= $pesan_tiket['harga']?></label>
</div>
<div class="form-group">
<label for="j_pemesanan">Jumlah tiket</label>
<input type="number" name="j_pemesanan" class="form-control" autofocus>
</div>
<div class="form-group">
<label for="via_pembayaran">Via Pembayaran</label>
<select class="form-control" name="via_pembayaran">
<option value="ATM">ATM</option>
<option value="BANK">BANK</option>
<option value="Kartu Kredit">Kartu Kredit</option>
<option value="Indomaret/Alfamart">Indomaret/Alfamart</option>
</select>
</div>
<button class="btn btn-primary mb-3" type="submit" name="submit">Beli</button>
<button class="btn btn-warning mb-3" type="reset">Reset</button>
</form>
</div>
</div>
</div>
<?php
include("template/footer.php")
?>
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