-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpass-cancel-specific-train.php
executable file
·231 lines (220 loc) · 11.4 KB
/
pass-cancel-specific-train.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<?php
session_start();
include('assets/inc/config.php');
//date_default_timezone_set('Africa /Nairobi');
include('assets/inc/checklogin.php');
check_login();
$aid=$_SESSION['pass_id'];
if(isset($_POST['Cancel_Train']))
{
/*
*We have already captured this passenger details....so no need of getting them again.
$pass_fname=$_POST['pass_fname'];
$pass_lname = $_POST['pass_lname'];
$pass_phone=$_POST['pass_phone'];
$pass_addr=$_POST['pass_addr'];
$pass_email=$_POST['pass_email'];
$pass_uname=$_POST['pass_uname'];
$pass_bday=$_POST['pass_bday'];
//$pass_ocupation=$_POST['pass_occupation'];
$pass_bio=($_POST['pass_bio']);
//$passwordconf=md5($_POST['passwordconf']);
//$date = date('d-m-Y h:i:s', time());
*/
$pass_train_number = $_POST['pass_train_number'];
$pass_train_name = $_POST['pass_train_name'];
$pass_dep_station = $_POST['pass_dep_station'];
$pass_dep_time = $_POST['pass_dep_time'];
$pass_arr_station = $_POST['pass_arr_station'];
$pass_train_fare = $_POST['pass_train_fare'];
//sql file to update the table of passengers with the new captured information
$query="update orrs_passenger set pass_train_number = ?, pass_train_name = ?, pass_dep_station = ?, pass_dep_time = ?, pass_arr_station = ?, pass_train_fare = ? where pass_id=?";
$stmt = $mysqli->prepare($query); //prepare sql and bind it later
$rc=$stmt->bind_param('ssssssi', $pass_train_number, $pass_train_name, $pass_dep_station, $pass_dep_time, $pass_arr_station, $pass_train_fare, $aid);
$stmt->execute();
if($stmt)
{
$succ = "Reserved Train Cancelled";
}
else
{
$err = "Please Try Again Later";
}
#echo"<script>alert('Your Profile Has Been Updated Successfully');</script>";
}
?>
<!DOCTYPE html>
<html lang="en">
<!--Head-->
<?php include('assets/inc/head.php');?>
<!--End Head-->
<body>
<div class="be-wrapper be-fixed-sidebar ">
<!--Navigation Bar-->
<?php include('assets/inc/navbar.php');?>
<!--End Navigation Bar-->
<!--Sidebar-->
<?php include('assets/inc/sidebar.php');?>
<!--End Sidebar-->
<div class="be-content">
<div class="page-head">
<h2 class="page-head-title">Canel My Train </h2>
<nav aria-label="breadcrumb" role="navigation">
<ol class="breadcrumb page-head-nav">
<li class="breadcrumb-item"><a href="pass-dashboard.php">Dashboard</a></li>
<li class="breadcrumb-item"><a href="#">Book Train</a></li>
<li class="breadcrumb-item active">Cancel Train</li>
</ol>
</nav>
</div>
<?php if(isset($succ)) {?>
<!--This code for injecting an alert-->
<script>
setTimeout(function ()
{
swal("Success!","<?php echo $succ;?>!","success");
},
100);
</script>
<?php } ?>
<?php if(isset($err)) {?>
<!--This code for injecting an alert-->
<script>
setTimeout(function ()
{
swal("Failed!","<?php echo $err;?>!","Failed");
},
100);
</script>
<?php } ?>
<div class="main-content container-fluid">
<?php
$aid=$_SESSION['pass_id'];
$ret="select * from orrs_passenger where pass_id=?";
$stmt= $mysqli->prepare($ret) ;
$stmt->bind_param('i',$aid);
$stmt->execute() ;//ok
$res=$stmt->get_result();
//$cnt=1;
while($row=$res->fetch_object())
{
?>
<div class="row">
<div class="col-md-12">
<div class="card card-border-color card-border-color-primary">
<div class="card-header card-header-divider"><span class="card-subtitle">Fill All Details</span></div>
<div class="card-body">
<form method ="POST">
<div class="form-group row">
<label class="col-12 col-sm-3 col-form-label text-sm-right" for="inputText3">My First Name</label>
<div class="col-12 col-sm-8 col-lg-6">
<input class="form-control" readonly name="pass_fname" value="<?php echo $row->pass_fname;?>" id="inputText3" type="text">
</div>
</div>
<div class="form-group row">
<label class="col-12 col-sm-3 col-form-label text-sm-right" for="inputText3">My Last Name</label>
<div class="col-12 col-sm-8 col-lg-6">
<input class="form-control" readonly name="pass_lname" value="<?php echo $row->pass_lname;?>" id="inputText3" type="text">
</div>
</div>
<div class="form-group row">
<label class="col-12 col-sm-3 col-form-label text-sm-right" for="inputText3">My Phone Number</label>
<div class="col-12 col-sm-8 col-lg-6">
<input class="form-control" readonly name="pass_phone" value="<?php echo $row->pass_phone;?>" id="inputText3" type="text">
</div>
</div>
<div class="form-group row">
<label class="col-12 col-sm-3 col-form-label text-sm-right" for="inputText3">My Address</label>
<div class="col-12 col-sm-8 col-lg-6">
<input class="form-control" readonly name="pass_addr" value="<?php echo $row->pass_addr;?>" id="inputText3" type="text">
</div>
</div>
<!--Lets get the details of one single train using its Train Id
and pass it to this user instance-->
<?php
$id=$_GET['pass_id'];
$ret="select * from orrs_passenger where pass_id=?";
$stmt= $mysqli->prepare($ret) ;
$stmt->bind_param('i',$id);
$stmt->execute() ;//ok
$res=$stmt->get_result();
//$cnt=1;
while($row=$res->fetch_object())
{
?>
<div class="form-group row">
<label class="col-12 col-sm-3 col-form-label text-sm-right" for="inputText3">Train Number</label>
<div class="col-12 col-sm-8 col-lg-6">
<input class="form-control" readonly name="pass_train_number" placeholder="<?php echo $row->pass_train_number;?>" id="inputText3" type="text">
</div>
</div>
<div class="form-group row">
<label class="col-12 col-sm-3 col-form-label text-sm-right" for="inputText3">Train Name</label>
<div class="col-12 col-sm-8 col-lg-6">
<input class="form-control" readonly name="pass_train_name" placeholder="<?php echo $row->pass_train_name;?>" id="inputText3" type="text">
</div>
</div>
<div class="form-group row">
<label class="col-12 col-sm-3 col-form-label text-sm-right" for="inputText3">My Departure Station</label>
<div class="col-12 col-sm-8 col-lg-6">
<input class="form-control" readonly name="pass_dep_station" placeholder="<?php echo $row->pass_dep_station;?>" id="inputText3" type="text">
</div>
</div>
<div class="form-group row">
<label class="col-12 col-sm-3 col-form-label text-sm-right" for="inputText3">My Arrival Station</label>
<div class="col-12 col-sm-8 col-lg-6">
<input class="form-control" readonly name="pass_arr_station" placeholder="<?php echo $row->pass_arr_station;?>" id="inputText3" type="text">
</div>
</div>
<div class="form-group row">
<label class="col-12 col-sm-3 col-form-label text-sm-right" for="inputText3">My Departure Time</label>
<div class="col-12 col-sm-8 col-lg-6">
<input class="form-control" readonly name="pass_dep_time" placeholder="<?php echo $row->pass_dep_time;?>" id="inputText3" type="text">
</div>
</div>
<div class="form-group row">
<label class="col-12 col-sm-3 col-form-label text-sm-right" for="inputText3">Train Fare</label>
<div class="col-12 col-sm-8 col-lg-6">
<input class="form-control" readonly name="pass_train_fare" placeholder="<?php echo $row->pass_train_fare;?>" id="inputText3" type="text">
</div>
</div>
<!--End TRain isntance-->
<?php }?>
<div class="col-sm-6">
<p class="text-right">
<input class="btn btn-space btn-outline-primary" value ="Cancel Train" name = "Cancel_Train" type="submit">
<button class="btn btn-space btn-secondary">Cancel</button>
</p>
</div>
</form>
</div>
</div>
</div>
<?php }?>
</div>
<!--footer-->
<?php include('assets/inc/footer.php');?>
<!--EndFooter-->
</div>
</div>
<script src="assets/lib/jquery/jquery.min.js" type="text/javascript"></script>
<script src="assets/lib/perfect-scrollbar/js/perfect-scrollbar.min.js" type="text/javascript"></script>
<script src="assets/lib/bootstrap/dist/js/bootstrap.bundle.min.js" type="text/javascript"></script>
<script src="assets/js/app.js" type="text/javascript"></script>
<script src="assets/lib/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script src="assets/lib/jquery.nestable/jquery.nestable.js" type="text/javascript"></script>
<script src="assets/lib/moment.js/min/moment.min.js" type="text/javascript"></script>
<script src="assets/lib/datetimepicker/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
<script src="assets/lib/select2/js/select2.min.js" type="text/javascript"></script>
<script src="assets/lib/select2/js/select2.full.min.js" type="text/javascript"></script>
<script src="assets/lib/bootstrap-slider/bootstrap-slider.min.js" type="text/javascript"></script>
<script src="assets/lib/bs-custom-file-input/bs-custom-file-input.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
//-initialize the javascript
App.init();
App.formElements();
});
</script>
</body>
</html>