-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadminSearchPatients.php
More file actions
144 lines (115 loc) · 4.26 KB
/
Copy pathadminSearchPatients.php
File metadata and controls
144 lines (115 loc) · 4.26 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
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
<!-- check for search submission -->
<?php
// ini_set("display_errors", 1);
include("config.php");
//getting first and last name from form
if (isset($_GET['firstName'])) {
$firstName = $_GET['firstName'];
} else {
$firstName = null;
}
if (isset($_GET['lastName'])) {
$lastName = $_GET['lastName'];
} else {
$lastName = null;
}
if (isset($lastName) && isset($firstName)) {
$validSearch = 1;
};
// query by patients first name last name
$stmt = $conn->prepare("SELECT * FROM patient WHERE firstName = ? AND lastName = ?");
$stmt->bind_param("ss", $firstName, $lastName);
$stmt->execute();
$result = $stmt->get_result();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>View staff</title>
<link rel="stylesheet" href="css/global.css" type="text/css" />
<link rel="stylesheet" href="css/mobile.css" type="text/css" media="only screen and (max-width : 620px)" />
<link rel="stylesheet" href="css/desktop.css" type="text/css" media="only screen and (min-width : 621px)" />
</head>
<body>
<div class="">
<div class="navbarContainer">
<?php
include("php/includes/admin/navbar.php");
?>
</div>
<div class="header">
<?php
include("php/includes/header.php");
?>
</div>
<div class="patientSearchTitle">
<h2>Search for Patient</h2><br>
</div>
<!-- form below allows admin to search for patients on the system -->
<div>
<div class="patientSearchForm">
<form method="get" action="patientSearch.php">
<div>
<label for="firstName">First Name:</label>
<input type="text" name="firstName" />
</div>
<div>
<label for="lastName">Second Name:</label>
<input type="text" name="lastName" />
</div>
<div>
<input type="submit" value="Search for a patient" />
</div>
</form>
</div><br><Br><Br>
<div class="patientFormResults">
<?php
if ($validSearch) {
echo "<p>Search found: {$result->num_rows} result(s)";
while ($obj = $result->fetch_object()) {
//enter columns from patients table
echo "<h3>Patient ID: ($obj->ID)</h3>";
echo "<h3>Name: ($obj->firstName)</h3>";
echo "<h3>Second name: ($obj->lastName)</h3>";
echo "<h3>Phone number: ($obj->phoneNumber)</h3>";
echo "<h3>Email: ($obj->email)</h3>";
echo "<h3>Registered doctor: ($obj->registeredDoctor)</h3>";
echo "<h3>Post code: ($obj->postCode)</h3>";
echo "<h3>Address: ($obj->address_)</h3>";
}
} else {
echo "<p>Search for a patient.</p>";
}
?>
</div><br><br>
</div>
<div class="footer">
<?php
include("php/includes/footer.php");
?>
</div>
<!-- scroll to top button -->
<script>
// Get button
let mybutton = document.getElementById("myBtn");
// When the user scrolls down by 20px from the top of the page, show 'scroll back to top' button
window.onscroll = function() {
scrollFunction()
};
function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}
// When user clicks on 'scroll back to top' button, scroll to top of the webpage
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
</script>
</body>
</html>