-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathview-user-booking.php
91 lines (84 loc) · 2.57 KB
/
view-user-booking.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
session_start();
//To prevent user to access the page without login
if(isset($_SESSION['username'])){
if($_SESSION['username'] == 'admin1' || $_SESSION['username'] == 'admin'){
header('Location: admin-login.php');
}
}
else{
header('Location: index.php');
}
include "config/connection.php";
// FOR PAGINATION
$sql = "SELECT * FROM ticket";
include "template/pagination.php";
$sql = "SELECT * FROM ticket WHERE booked_by = '".$_SESSION['username']."' LIMIT " . $page_first_result . ',' . $results_per_page;
$result = $conn->query($sql);
$conn->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bookings</title>
</head>
<?php include "template/header-name.php" ?>
<style>
table {
width: 90%;
margin: 0 auto;
font-size: large;
border: 2px solid rgb(120, 120, 120);
}
td {
background-color: #E4F5D4;
border: 2px solid rgb(120, 120, 120);
}
th, td {
font-weight: bold;
border: 2px dotted rgb(120, 120, 120);
padding: 10px;
text-align: left;
}
td {
font-weight: lighter;
}
</style>
<div style="margin-top:200px;">
<form style = "width: 80%;">
<h3 class ="heading">Your Previous Booking Details</h3><br>
<section>
<table>
<tr>
<th>PNR No</th>
<th>Train Number</th>
<th>Date</th>
<th>Coach</th>
<th>Booked At</th>
</tr>
<?php
while($rows=$result->fetch_assoc())
{
?>
<tr>
<td><h5><?php echo $rows['pnr_no'];?></h5></td>
<td><h5><?php echo $rows['t_number'];?></h5></td>
<td><h5><?php echo $rows['t_date'];?></h5></td>
<td><h5><?php echo $rows['coach'];?></h5></td>
<td><h5><?php echo $rows['booked_at'];?></h5></td>
</tr>
<?php
}
?>
</table>
</section>
<br><br>
<?php for($page = 1; $page<= $number_of_page; $page++) { ?>
<?php echo '<a class="register" href = "view-user-booking.php?page=' . $page . '">' . $page . ' </a>'; ?>
<?php } ?>
<br><br><br>
<a href="admin-page.php" class= "register">Back</a>
</form>
</div>
<?php include "template/footer.php" ?>
</html>