-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpass-profile-update.php
193 lines (184 loc) · 9.18 KB
/
pass-profile-update.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
<?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['Update_Profile']))
{
$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());
$query="update RailwayReservationSystem_passenger set pass_fname = ?, pass_lname = ?, pass_phone = ?, pass_addr = ?, pass_email = ?, pass_uname = ?, pass_bday = ?, pass_bio = ? where pass_id=?";
$stmt = $mysqli->prepare($query);
$rc=$stmt->bind_param('ssssssssi', $pass_fname, $pass_lname, $pass_phone, $pass_addr, $pass_email, $pass_uname, $pass_bday, $pass_bio, $aid);
$stmt->execute();
if($stmt)
{
$succ = "Your Profile Has Been Updated";
}
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">Profile </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="#">Profile</a></li>
<li class="breadcrumb-item active">Update Profile</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 RailwayReservationSystem_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-success">
<div class="card-header card-header-divider">Update Your Profile<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">First Name</label>
<div class="col-12 col-sm-8 col-lg-6">
<input class="form-control" 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"> Last Name</label>
<div class="col-12 col-sm-8 col-lg-6">
<input class="form-control" 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"> Phone Number</label>
<div class="col-12 col-sm-8 col-lg-6">
<input class="form-control" 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"> Address</label>
<div class="col-12 col-sm-8 col-lg-6">
<input class="form-control" name="pass_addr" value="<?php echo $row->pass_addr;?>" 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"> Email</label>
<div class="col-12 col-sm-8 col-lg-6">
<input class="form-control" name="pass_email" value="<?php echo $row->pass_email;?>" 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"> Username</label>
<div class="col-12 col-sm-8 col-lg-6">
<input class="form-control" name="pass_uname" value="<?php echo $row->pass_uname;?>" 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"> Birthday</label>
<div class="col-12 col-sm-8 col-lg-6">
<input class="form-control" name="pass_bday" value="<?php echo $row->pass_bday;?>" 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"> Bio</label>
<div class="col-12 col-sm-8 col-lg-6">
<textarea class="form-control" name="pass_bio" id="inputText3" type="text"><?php echo $row->pass_bio;?></textarea>
</div>
</div>
<div class="col-sm-6">
<p class="text-right">
<input class="btn btn-space btn-success" value ="Update Profile" name = "Update_Profile" type="submit">
<button class="btn btn-space btn-secondary">Cancel</button>
</p>
</div>
</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>