-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.php
298 lines (280 loc) · 11.8 KB
/
register.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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
<?php
session_start(); // Add this line to start the session
include "db.php";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST["name"];
$patient_id = $_POST["patient_id"];
$gender = $_POST["gender"];
$age = $_POST["age"];
$eth = $_POST["eth"];
$blood_type = $_POST["blood_type"];
$cond = $_POST["condition"]; // Corrected variable name
$area = $_POST["area"];
$number = $_POST["number"];
$chronic = $_POST["chronic"];
$birthdate = $_POST["birthdate"];
$creationdate = $_POST["creationdate"];
$treatment =$_POST["treatment"];
$dosage = $_POST["dosage"];
$frequency = $_POST["frequency"];
$stmt = $con->prepare("SELECT * FROM patients WHERE patient_id = ?");
$stmt->execute(array($patient_id));
if ($stmt->rowCount() > 0) {
$_SESSION["registerError"] = "This patient ID is already registered";
header('Location: register.php');
exit(); // Add exit() to stop further execution
} else {
$stmt = $con->prepare("INSERT INTO patients (name, patient_id, gender, age, eth, blood_type, cond, area, number, chronic, birthdate, creationdate,treatment,dosage,frequency)
VALUES (:name, :patient_id, :gender, :age, :eth, :blood_type, :cond, :area, :number, :chronic, :birthdate, :creationdate,:treatment,:dosage,:frequency)");
$stmt->execute(array(
"name" => $name,
"patient_id" => $patient_id,
"gender" => $gender,
"age" => $age,
"eth" => $eth,
"blood_type" => $blood_type,
"cond" => $cond,
"area" => $area,
"number" => $number,
"chronic" => $chronic,
"birthdate" => $birthdate,
"creationdate" => $creationdate,
"treatment" =>$treatment,
"dosage" => $dosage,
"frequency" => $frequency,
));
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>PatientPortal</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-*">
<a class="logo" href="#"><img src="images/logo4 (2).png"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<a class="navbar-brand" href="#">Patient Portal</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="index.php">HOME <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#patient">ADD NEW PATIENT</a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.php">PHYSICIANS</a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.php">PATIENTS</a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.php">AREAS</a>
</li>
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
Explore Patient Portal
</button>
<ul class="dropdown-menu">
<a><a class="dropdown-item" href="searcharea.php">SEARCH BY AREA</a></a>
<a><a class="dropdown-item" href="searchcond.php">SEARCH BY CONDITION/MEDICATION</a></a>
</ul>
</div>
<li class="nav-item">
<a class="nav-link" href="#contact">CONTACT US</a>
</li>
</ul>
</div>
</nav>
<div id="patient"><nav class="navbar navbar-light bg-*">
<a class="navbar-brand" href="#">
<img src="images/a.png" width="30" height="30" class="d-inline-block align-top" alt="">
Register a New Patient
</a>
</div>
</nav>
<form method="POST" action="register.php">
<div class="form-row ">
<div class="form-group col-md-6">
<label for="inputEmail4">Patient Id</label>
<input type="number" class="form-control" id="inputEmail4" name="patient_id" placeholder="Identification Number">
</div>
<div class="form-group col-md-6">
<label for="inputPassword4">Name</label>
<input type="text" class="form-control" id="inputPassword4" name="name" placeholder="Enter your full name">
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label for="inputEmail4">Gender</label>
<input type="text" class="form-control" id="inputEmail4" name="gender" placeholder="Select your gender">
</div>
<div class="form-group col-md-3">
<label for="inputPassword4">Blood Type</label>
<input type="text" class="form-control" id="inputPassword4" name="blood_type" placeholder="Blood type (e.g., A+, B-, AB, O...)">
</div>
<div class="form-group col-md-3">
<label for="inputPassword4">Age</label>
<input type="text" class="form-control" id="inputPassword4" name="age" placeholder="Age in years">
</div>
<div class="form-group col-md-3">
<label for="inputPassword4">Ethnicity</label>
<input type="text" class="form-control" id="inputPassword4" name="eth" placeholder="Ethnicity (optional)">
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label for="inputEmail4">Condition</label>
<input type="text" class="form-control" id="inputEmail4" name="condition" placeholder="Patient condition or symptoms">
</div>
<div class="form-group col-md-3">
<label for="inputPassword4">Chronic Disease</label>
<input type="text" class="form-control" id="inputPassword4" name="chronic" placeholder="Chronic diseases (if applicable)">
</div>
<div class="form-group col-md-3">
<label for="inputPassword4">Phone Number</label>
<input type="text" class="form-control" id="inputPassword4" name="number" placeholder="+20 01XXXXXXXXX">
</div>
<div class="form-group col-md-3">
<label for="inputPassword4">Adress/Area</label>
<input type="text" class="form-control" id="inputPassword4" name="area" placeholder="Patient location">
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<p> <label for="inputCity">Birth Date</label>
<input type="date" class="form-control" id="inputCity" name="birthdate" placeholder="MM/DD/YYYY">
</div>
<div class="form-group col-md-6">
<label for="inputCity">Creation Date</label>
<input type="date" class="form-control" id="inputCity" name="creationdate" placeholder="MM/DD/YYYY">
</div>
<div class="mb-3">
<label for="formFile" class="form-label">Previous Medications or Films/Prescriptions</label>
<input class="form-control" type="file" id="formFile">
</div>
<div class="form-group col-md-3">
<label for="inputPassword4">Treatment Plan</label>
<input type="text" class="form-control" id="inputPassword4" name="treatment" placeholder="Treatment Plan or Medication specified by practitioner">
</div>
<div class="form-group col-md-3">
<label for="inputPassword4">Dosage</label>
<input type="text" class="form-control" id="inputPassword4" name="dosage" placeholder="Medication">
</div>
<div class="form-group col-md-3">
<label for="inputPassword4">Frequency/Day</label>
<input type="text" class="form-control" id="inputPassword4" name="frequency" placeholder="Frequency of Dosage">
</div>
</div>
<button type="submit" class="btn btn-success btn-lg ">Add</button>
</form>
<!-- Section: Links -->
<ls id="contact">
<section class="">
<div class="container text-center text-md-start mt-5">
<!-- Grid row -->
<div class="row mt-3">
<!-- Grid column -->
<div class="col-md-3 col-lg-4 col-xl-3 mx-auto mb-4">
<!-- Content -->
<h6 class="text-uppercase fw-bold mb-4">
<i class="fas fa-gem me-3 text-secondary"></i>Patient Portal</h6>
<p>
Here you can use rows and columns to organize your footer content. Lorem ipsum
dolor sit amet, consectetur adipisicing elit.
</p>
</div>
<!-- Grid column -->
<!-- Grid column -->
<div class="col-md-2 col-lg-2 col-xl-2 mx-auto mb-4">
<!-- Links -->
<h6 class="text-uppercase fw-bold mb-4">
Avaliable Data
</h6>
<p>
<a href="#!" class="text-reset">PATIENTS</a>
</p>
<p>
<a href="#!" class="text-reset">PHYSICIANS</a>
</p>
<p>
<a href="#!" class="text-reset">AREAS OF TREATMENT</a>
</p>
<p>
<a href="#!" class="text-reset"></a>
</p>
</div>
<div class="col-md-4 col-lg-3 col-xl-3 mx-auto mb-md-0 mb-4">
<!-- Links -->
<h6 class="text-uppercase fw-bold mb-4">Contact</h6>
<p><i class="fas fa-home me-3 text-secondary"></i> Alexandria, Borg AlArab, Egypt</p>
<p>
<i class="fas fa-envelope me-3 text-secondary"></i> [email protected]
</p>
<p><i class="fas fa-phone me-3 text-secondary"></i> +20 01550496604</p>
</div>
</div>
</div>
</section>
<div class="text-center p-4" style="background-color: rgba(0, 0, 0, 0.025);">
© 2023 Copyright:
<a class="text-reset fw-bold" href="https://mdbootstrap.com/"> PatientPortal.com</a>
</div>
</footer>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
<?php
// if ($_SERVER["REQUEST_METHOD"] == "POST") {
// $name = $_POST["name"];
// $patient_id = $_POST["patient_id"];
// $gender = $_POST["gender"];
// $age = $_POST["age"];
// $eth = $_POST["eth"];
// $blood_type = $_POST["blood_type"];
// $cond = $_POST["cond"];
// $area = $_POST["area"];
// $number = $_POST["number"];
// $chronic = $_POST["chronic"];
// $birthdate = $_POST["birthdate"];
// $creationdate = $_POST["creationdate"];
// $stmt = $con->prepare("SELECT * FROM patients WHERE patient_id=?");
// $stmt->execute(array($patient_id));
// if ($stmt->rowCount() > 0) {
// $_SESSION["registerError"] = "This patient ID is already registered";
// header('Location: register.php');
// } else {
// $stmt = $con->prepare("INSERT INTO patients (name, patient_id, gender, age, eth, blood_type, condition, area, number, chronic, birthdate, creationdate)
// VALUES (:name, :patient_id, :gender, :age, :eth, :blood_type, :condition, :area, :number, :chronic, :birthdate, :creationdate)");
// $stmt->execute(array(
// "name" => $name,
// "patient_id" => $patient_id,
// "gender" => $gender,
// "age" => $age,
// "eth" => $eth,
// "blood_type" => $blood_type,
// "condition" => $cond,
// "area" => $area,
// "number" => $number,
// "chronic" => $chronic,
// "birthdate" => $birthdate,
// "creationdate" => $creationdate,
// ));
// }
// echo "hi";
// }
// ?>