-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmember-edit.php
275 lines (257 loc) · 8.35 KB
/
member-edit.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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>ATI Kegalle - Your Profile</title>
<!-- Font Awesome -->
<link
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css"
rel="stylesheet"
/>
<!-- Google Fonts -->
<link
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
rel="stylesheet"
/>
<!-- MDB -->
<link
href="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/3.5.0/mdb.min.css"
rel="stylesheet"
/>
</head>
<body>
<?php
session_start();
if(isset($_SESSION["member"]) && $_SESSION["member"] != ""){
require 'conn.php';
$sql="SELECT * FROM `member` WHERE `MemUName`='".$_SESSION["member"]."';";
$result = mysqli_query( $conn, $sql );
if ( mysqli_num_rows( $result ) > 0 ) {
$row = mysqli_fetch_assoc( $result );
$uname=$row['MemUName'];
$name=$row['MemName'];
$dob=$row['MemDOB'];
$add=$row['MemAddress'];
$dep=$row['MemDept'];
$des=$row['MemDesig'];
$age=$row['MemAge'];
$nic=$row['MemNIC'];
$gender=$row['MemGender'];
$phone=$row['MemMobile'];
$email=$row['MemEmail'];
}else{
header("location:member-login-profile.php?status=fail");
}
}else{
header("location:member-login-profile.php");
exit;
}
?>
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-dark mb-3" style="background-color:#03045e;">
<!-- Container wrapper -->
<div class="container-fluid">
<!-- Navbar brand -->
<a class="navbar-brand" href="index.html"><img src="assets/logo.png" width="30" height="30" alt=""></a>
<!-- Toggle button -->
<button class="navbar-toggler" type="button" data-mdb-toggle="collapse" data-mdb-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<i class="fas fa-bars"></i>
</button>
<!-- Collapsible wrapper -->
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0 ">
<!-- Link -->
<li class="nav-item">
<a class="nav-link" href="announcement.html">Announcements</a>
</li>
<li class="nav-item">
<a class="nav-link" href="gallery.html">Gallery</a>
</li>
<li class="nav-item">
<a class="nav-link" href="contact.html">Contact Us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="member-enter.html"><text style="color: aqua;"><strong>Enter ATI</strong> </text></a>
</li>
<!-- Login Dropdown -->
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-mdb-toggle="dropdown" aria-expanded="false">
<i class="fa fa-fw fa-user"></i>
</a>
<!-- Dropdown menu -->
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li>
<a class="dropdown-item" href="profile.html">Your Profile</a>
</li>
<li>
<a class="dropdown-item" href="register.html">Register</a>
</li>
<li>
<a class="dropdown-item" href="login.html">Login</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- Container wrapper -->
</nav>
<!-- Navbar -->
<br />
<!-- Content-->
<div class="container mb-5">
<div class="row">
<div class="col-12">
<h2 class="text-center">Your Profile</h2>
</div>
</div>
<br />
<div class="row">
<div class="col-12">
<form method="post" action="member-edit.php">
<table class="table">
<tbody>
<tr>
<th scope="row">1</th>
<td>Name</td>
<td>
<input type="text" id="typeText" class="form-control" required name="name" value="<?php echo($name) ?>"/>
</td>
</tr>
<tr>
<th scope="row">2</th>
<td>User Name</td>
<td>
<input type="text" id="typeText" class="form-control" readonly name="uname" value="<?php echo($uname) ?>"/>
</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Department</td>
<td>
<div class="mb-4">
<select name="dep">
<option value="" disabled selected>Choose your option</option>
<option value="IT">IT</option>
<option value="Accounting">Accounting</option>
<option value="English">English</option>
<option value="Project Management">Project Management</option>
</select>
<label><?php echo($dep) ?></label>
</div>
</td>
</tr>
<tr>
<th scope="row">4</th>
<td>Designation</td>
<td>
<div class="mb-4">
<select name="des">
<option value="" disabled selected>Choose your option</option>
<option value="Director">Director</option>
<option value="Academic">Academic</option>
<option value="Student">Student</option>
<option value="Non-academic">Non-academic</option>
</select>
<label><?php echo($des) ?></label>
</div>
</td>
</tr>
<tr>
<th scope="row">5</th>
<td>NIC</td>
<td>
<input type="text" id="typeText" class="form-control" name="nic" required value="<?php echo($nic) ?>" />
</td>
</tr>
<tr>
<th scope="row">6</th>
<td>Birthday</td>
<td>
<input type="date" id="typeText" class="form-control" required name="dob" value="<?php echo($dob) ?>"/>
</td>
</tr>
<tr>
<th scope="row">7</th>
<td>Age</td>
<td>
<input type="number" id="typeNumber" class="form-control" name="age" required value="<?php echo($age) ?>" />
</td>
</tr>
<tr>
<th scope="row">8</th>
<td>Address</td>
<td>
<input type="text" id="typeText" class="form-control" required name="add" value="<?php echo($add) ?>"/>
</td>
</tr>
<tr>
<th scope="row">9</th>
<td>Gender</td>
<td>
<select name="gender" required>
<option value="" disabled selected>
Choose your option
</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
<label><?php echo($gender) ?></label>
</td>
</tr>
<tr>
<th scope="row">10</th>
<td>Mobile</td>
<td>
<input type="tel" id="typeNumber" class="form-control" name="phone" required value="<?php echo($phone) ?>"/>
</td>
</tr>
<tr>
<th scope="row">11</th>
<td>Email</td>
<td>
<input type="email" id="typeEmail" class="form-control" required name="email" value="<?php echo($email) ?>"/>
</td>
</tr>
</tbody>
</table>
<div class="text-center pb-3">
<button type="submit" class="btn btn-success" name="save">Save</button>
<button type="submit" name="logout" style="background-color: red;" class="btn btn-success" name="logout">Logout</button>
</form>
</div>
</div>
</div>
</div>
<?php
if(isset($_POST['save'])){
$sql = "UPDATE `member` SET `MemName`='".$_POST["name"]."',`MemDOB`='".$_POST["dob"]."',`MemAddress`='".$_POST["add"]."',`MemDept`='".$_POST["dep"]."',`MemDesig`='".$_POST["des"]."',`MemAge`='".$_POST["age"]."',`MemNIC`='".$_POST["nic"]."',`MemGender`='".$_POST["gender"]."',`MemMobile`='".$_POST["tel"]."',`MemEmail`='".$_POST["mail"]."' WHERE `MemUName`='".$_SESSION["member"]."';";
if ( $conn->query( $sql ) === TRUE ) {
echo "<script> location.href='member-profile.php'; </script>";
}else{
echo"error";
}
}
if ( isset( $_POST[ 'logout' ] ) ) {
unset( $_SESSION );
session_destroy();
echo "<script> location.href='member-login-profile.php'; </script>";
}
?>
<!-- Footer -->
<footer class="footer text-center text-white fixed-bottom">
<div
class="text-center p-0"
style="background-color: rgba(0, 0, 0, 0.774)"
>
Made with ❤️ by HNDIT 2019 batch.
</div>
</footer>
<!-- MDB -->
<script
type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mdb-ui-kit/3.5.0/mdb.min.js"
></script>
</body>
</html>