-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatient_dashboard.php
More file actions
117 lines (106 loc) · 3.1 KB
/
Copy pathpatient_dashboard.php
File metadata and controls
117 lines (106 loc) · 3.1 KB
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
<?php
session_start();
// Check if patient is logged in
if (!isset($_SESSION['user']) || $_SESSION['user']['role'] !== 'patient') {
header("Location: login.php");
exit;
}
include 'db.php';
$patient = $_SESSION['user'];
// Fetch appointments
$appointments_query = "SELECT * FROM appointments WHERE patient_id = " . $patient['id'];
$appointments_result = mysqli_query($conn, $appointments_query);
// updated remarks from database
$patient_query = "SELECT remarks FROM patients WHERE id = " . $patient['id'];
$patient_result = mysqli_query($conn, $patient_query);
$patient_info = mysqli_fetch_assoc($patient_result);
$remarks = $patient_info['remarks'] ?? 'No remarks available.';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Patient Dashboard - Random Clinic</title>
<link rel="stylesheet" href="assets/style.css">
<style>
body {
background-color: #f4f7fa;
font-family: Arial, sans-serif;
margin: 0;
padding: 30px;
}
.dashboard {
background: #fff;
max-width: 900px;
margin: auto;
padding: 40px;
border-radius: 12px;
box-shadow: 0 0 15px rgba(0,0,0,0.1);
}
h2, h3 {
color: #373b94;
margin-bottom: 20px;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 10px;
background: #fdfdfd;
}
th, td {
padding: 12px;
border: 1px solid #ccc;
text-align: left;
}
.remarks-box {
background: #fff9d6;
padding: 15px;
border: 1px solid #ffe58f;
border-radius: 6px;
margin-top: 20px;
white-space: pre-wrap;
word-wrap: break-word;
overflow-wrap: break-word;
}
a {
display: inline-block;
margin-top: 30px;
color: #373b94;
text-decoration: none;
font-weight: bold;
}
a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="dashboard">
<h2>Welcome, <?= htmlspecialchars($patient['name']) ?></h2>
<h3>Your Appointments</h3>
<?php if (mysqli_num_rows($appointments_result) > 0): ?>
<table>
<tr>
<th>Date</th>
<th>Time</th>
<th>Status</th>
</tr>
<?php while ($appt = mysqli_fetch_assoc($appointments_result)): ?>
<tr>
<td><?= htmlspecialchars($appt['appointment_date']) ?></td>
<td><?= htmlspecialchars($appt['appointment_time']) ?></td>
<td><?= htmlspecialchars($appt['status']) ?></td>
</tr>
<?php endwhile; ?>
</table>
<?php else: ?>
<p>No appointments found.</p>
<?php endif; ?>
<h3>Doctor's Remarks</h3>
<div class="remarks-box">
<?= nl2br(htmlspecialchars($remarks)) ?>
</div>
<a href="logout.php">← Logout</a>
</div>
</body>
</html>