-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile.php
265 lines (227 loc) · 7.44 KB
/
profile.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
<?php
//profile.php
include('class/Appointment.php');
$object = new Appointment;
$object->query = "
SELECT * FROM patient_table
WHERE patient_id = '".$_SESSION["patient_id"]."'
";
$result = $object->get_result();
include('header.php');
?>
<?php include('header_patient.php'); ?>
<div class="container-fluid">
<div class="row justify-content-md-center">
<div class="col col-md-6">
<br />
<?php
if(isset($_GET['action']) && $_GET['action'] == 'edit')
{
?>
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-md-6">
Edit Profile Details
</div>
<div class="col-md-6 text-right">
<a href="profile.php" class="btn btn-secondary btn-sm">View</a>
</div>
</div>
</div>
<div class="card-body">
<form method="post" id="edit_profile_form">
<div class="form-group">
<label>Patient Email Address<span class="text-danger">*</span></label>
<input type="text" name="patient_email_address" id="patient_email_address" class="form-control" required autofocus data-parsley-type="email" data-parsley-trigger="keyup" readonly />
</div>
<div class="form-group">
<label>Patient Password<span class="text-danger">*</span></label>
<input type="password" name="patient_password" id="patient_password" class="form-control" required data-parsley-trigger="keyup" />
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label>Patient First Name<span class="text-danger">*</span></label>
<input type="text" name="patient_first_name" id="patient_first_name" class="form-control" required data-parsley-trigger="keyup" />
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Patient Last Name<span class="text-danger">*</span></label>
<input type="text" name="patient_last_name" id="patient_last_name" class="form-control" required data-parsley-trigger="keyup" />
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label>Patient Date of Birth<span class="text-danger">*</span></label>
<input type="text" name="patient_date_of_birth" id="patient_date_of_birth" class="form-control" required data-parsley-trigger="keyup" readonly />
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Patient Gender<span class="text-danger">*</span></label>
<select name="patient_gender" id="patient_gender" class="form-control">
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Other">Other</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label>Patient Contact No.<span class="text-danger">*</span></label>
<input type="text" name="patient_phone_no" id="patient_phone_no" class="form-control" required data-parsley-trigger="keyup" />
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Patient Maritial Status<span class="text-danger">*</span></label>
<select name="patient_maritial_status" id="patient_maritial_status" class="form-control">
<option value="Single">Single</option>
<option value="Married">Married</option>
<option value="Seperated">Seperated</option>
<option value="Divorced">Divorced</option>
<option value="Widowed">Widowed</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<label>Patient Complete Address<span class="text-danger">*</span></label>
<textarea name="patient_address" id="patient_address" class="form-control" required data-parsley-trigger="keyup"></textarea>
</div>
<div class="form-group text-center">
<input type="hidden" name="action" value="edit_profile" />
<input type="submit" name="edit_profile_button" id="edit_profile_button" class="btn btn-primary" value="Edit" />
</div>
</form>
</div>
</div>
<br />
<br />
<?php
}
else
{
if(isset($_SESSION['success_message']))
{
echo $_SESSION['success_message'];
unset($_SESSION['success_message']);
}
?>
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-md-6">
Profile Details
</div>
<div class="col-md-6 text-right">
<a href="profile.php?action=edit" class="btn btn-secondary btn-sm">Edit</a>
</div>
</div>
</div>
<div class="card-body">
<table class="table table-striped">
<?php
foreach($result as $row)
{
?>
<tr>
<th class="text-right" width="40%">Patient Name</th>
<td><?php echo $row["patient_first_name"] . ' ' . $row["patient_last_name"]; ?></td>
</tr>
<tr>
<th class="text-right" width="40%">Email Address</th>
<td><?php echo $row["patient_email_address"]; ?></td>
</tr>
<tr>
<th class="text-right" width="40%">Password</th>
<td><?php echo $row["patient_password"]; ?></td>
</tr>
<tr>
<th class="text-right" width="40%">Address</th>
<td><?php echo $row["patient_address"]; ?></td>
</tr>
<tr>
<th class="text-right" width="40%">Contact No.</th>
<td><?php echo $row["patient_phone_no"]; ?></td>
</tr>
<tr>
<th class="text-right" width="40%">Date of Birth</th>
<td><?php echo $row["patient_date_of_birth"]; ?></td>
</tr>
<tr>
<th class="text-right" width="40%">Gender</th>
<td><?php echo $row["patient_gender"]; ?></td>
</tr>
<tr>
<th class="text-right" width="40%">Maritial Status</th>
<td><?php echo $row["patient_maritial_status"]; ?></td>
</tr>
<?php
}
?>
</table>
</div>
</div>
<br />
<br />
<?php
}
?>
</div>
</div>
</div>
<?php
include('footer.php');
?>
<script>
$(document).ready(function(){
$('#patient_date_of_birth').datepicker({
format: "yyyy-mm-dd",
autoclose: true
});
<?php
foreach($result as $row)
{
?>
$('#patient_email_address').val("<?php echo $row['patient_email_address']; ?>");
$('#patient_password').val("<?php echo $row['patient_password']; ?>");
$('#patient_first_name').val("<?php echo $row['patient_first_name']; ?>");
$('#patient_last_name').val("<?php echo $row['patient_last_name']; ?>");
$('#patient_date_of_birth').val("<?php echo $row['patient_date_of_birth']; ?>");
$('#patient_gender').val("<?php echo $row['patient_gender']; ?>");
$('#patient_phone_no').val("<?php echo $row['patient_phone_no']; ?>");
$('#patient_maritial_status').val("<?php echo $row['patient_maritial_status']; ?>");
$('#patient_address').val("<?php echo $row['patient_address']; ?>");
<?php
}
?>
$('#edit_profile_form').parsley();
$('#edit_profile_form').on('submit', function(event){
event.preventDefault();
if($('#edit_profile_form').parsley().isValid())
{
$.ajax({
url:"action.php",
method:"POST",
data:$(this).serialize(),
beforeSend:function()
{
$('#edit_profile_button').attr('disabled', 'disabled');
$('#edit_profile_button').val('wait...');
},
success:function(data)
{
window.location.href = "profile.php";
}
})
}
});
});
</script>