Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PSW_II_PARIWISATA_TRANSPORTASI
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Proyek_PSW_II_PARIWISATA
PSW_II_PARIWISATA_TRANSPORTASI
Commits
c96b0084
Commit
c96b0084
authored
Jun 06, 2020
by
11319009_Pratiwi Sibarani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
efa0825a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
124 additions
and
0 deletions
+124
-0
ubahtiket.php
transportasi/admin/ubahtiket.php
+124
-0
No files found.
transportasi/admin/ubahtiket.php
0 → 100644
View file @
c96b0084
<?php
session_start
();
include
(
'../config.php'
);
include
(
"template/header.php"
);
include
(
"../common/function.php"
);
include
(
"function.php"
);
open_page
(
"Ubah Tiket"
);
// 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
=
$_GET
[
"id"
];
// kita query
$tiket
=
query
(
"SELECT t_tiketsdia.id ,t_tiketsdia.kode_tiket, destinasi.nama_destinasi, pt_trans.nama_transp, t_tiketsdia.harga
FROM 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 WHERE id =
$id
"
)[
0
];
if
(
isset
(
$_POST
[
"submit"
]))
{
if
(
ubahtiket
(
$_POST
)
>
0
)
{
echo
"
<script>
alert('Berhasil diubah');
document.location.href = 'tiket_admin.php';
</script>
"
;
}
else
{
echo
"
<script>
alert('Gagal diubah');
document.location.href = 'tiket_admin.php';
</script>
"
;
}
}
?>
<!-- ======= Breadcrumbs ======= -->
<section
id=
"breadcrumbs"
class=
"breadcrumbs"
>
<div
class=
"container"
>
<div
class=
"d-flex justify-content-between align-items-center"
>
<h2>
Ubah Tiket
</h2>
</div>
</div>
</section>
<!-- End Breadcrumbs -->
<div
class=
"modal-dialog"
role=
"document"
>
<?php
$query2
=
"SELECT pt_trans.id_transp, pt_trans.nama_transp FROM pt_trans"
;
$ubah1
=
mysqli_query
(
$koneksi
,
$query2
);
$query3
=
"SELECT destinasi.id_destinasi, destinasi.nama_destinasi FROM destinasi"
;
$ubah2
=
mysqli_query
(
$koneksi
,
$query3
);
?>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<h2>
Ubah Tiket
</h2>
</div>
<div
class=
"modal-body"
>
<form
action=
""
method=
"post"
>
<input
type=
"hidden"
name=
"id"
value=
"
<?=
$tiket
[
'id'
]
?>
"
>
<div
class=
"form-group"
>
<label
for=
"t_destinasi"
>
Tujuan Destinasi
</label><br>
<label
for=
"t_destinasi"
>
Tujuan Sebelum :
<?=
$tiket
[
'nama_destinasi'
]
?>
</label>
<select
class=
"form-control"
name=
"t_destinasi"
>
<?php
while
(
$kendaraan
=
mysqli_fetch_array
(
$ubah2
))
{
?>
<option
value=
"
<?=
$kendaraan
[
'id_destinasi'
]
?>
"
>
<?=
$kendaraan
[
'nama_destinasi'
]
?>
</option>
<?php
}
?>
</select>
</div>
<div
class=
"form-group"
>
<label
for=
"t_kendaraan"
>
Kendaraan
</label><br>
<label
for=
"t_kendaraan"
>
Kendaraan Sebelum :
<?=
$tiket
[
'nama_transp'
]
?>
</label>
<select
class=
"form-control"
name=
"t_kendaraan"
>
<?php
while
(
$kendaraan
=
mysqli_fetch_array
(
$ubah1
))
{
?>
<option
value=
"
<?=
$kendaraan
[
'id_transp'
]
?>
"
>
<?=
$kendaraan
[
'nama_transp'
]
?>
</option>
<?php
}
?>
</select>
</div>
<div
class=
"form-group"
>
<label
for=
"harga"
>
Harga Tiket
</label>
<input
type=
"text"
name=
"harga"
class=
"form-control"
placeholder=
"Masukkan harga tiket"
value=
"
<?=
$tiket
[
'harga'
]
?>
"
>
</div>
<button
class=
"btn btn-primary mb-3"
type=
"submit"
name=
"submit"
>
Ubah
</button>
</form>
</div>
</div>
</div>
<?php
include
(
"template/footer.php"
)
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment