Upload New File

parent 4bdcb3c7
<?php
session_start();
include('../config.php');
include("template/header.php");
include("../common/function.php");
include("function.php");
open_page("Ubah Destinasi");
// include("../common/dbconfig.php");
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 != "admin"){
echo "<script>alert('Anda bukan admin');window.location='../index.php';</script>";
exit;
}
$id_akun = $_SESSION["id_akun"];
$nama = $_SESSION["nama"];
$username = $_SESSION["username"];
$id_destinasi = $_GET["id_destinasi"];
// kita query
$destinasi = query("SELECT * FROM destinasi WHERE id_destinasi = $id_destinasi")[0];
if(isset($_POST["submit"]))
{
if(ubahdestinasi($_POST) > 0)
{
echo
"
<script>
alert('Berhasil diubah');
document.location.href = 'destinasi_admin.php';
</script>
";
}else{
echo
"
<script>
alert('Gagal diubah');
document.location.href = 'destinasi_admin.php';
</script>
";
}
}
?>
<!-- ======= Breadcrumbs ======= -->
<section id="breadcrumbs" class="breadcrumbs">
<div class="container">
<div class="d-flex justify-content-between align-items-center">
<h2>Ubah Destinasi</h2>
</div>
</div>
</section>
<!-- End Breadcrumbs -->
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h2>Ubah Destinasi</h2>
</div>
<div class="modal-body">
<form action="" method="post" enctype="multipart/form-data">
<input type="hidden" name="id_destinasi" value="<?= $destinasi['id_destinasi']?>" >
<div class="form-group">
<label for="nama_destinasi">Nama Destinasi</label>
<input type="text" name="nama_destinasi" class="form-control" value="<?= $destinasi['nama_destinasi']?>" >
</div>
<div class="form-group">
<label for="pulau">Pulau</label>
<input type="text" name="pulau" class="form-control" value="<?= $destinasi['pulau']?>">
</div>
<div class="form-group">
<label for="provinsi">Provinsi</label>
<input type="text" name="provinsi" class="form-control" value="<?= $destinasi['provinsi']?>">
</div>
<div class="form-group">
<label for="deskripsi_destinasi">Deskripsi</label>
<input type="text" name="deskripsi_destinasi" class="form-control" value="<?= $destinasi['deskripsi_destinasi']?>">
</div>
<div class="form-group">
<label for="gambar_destinasi">Gambar</label>
<img src="<?= BASEURL; ?>public/img/<?= $destinasi['gambar_destinasi'] ?>" class="align-self-center mr-5 mt-3" alt="gambar_destinasi" style="width:300px;length:300px">
<input type="file" name="gambar_destinasi" />
</div>
<button class="btn btn-primary mb-3" type="submit" name="submit">Submit</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