-
Notifications
You must be signed in to change notification settings - Fork 0
/
editpat.php
219 lines (207 loc) · 11 KB
/
editpat.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
<?php
include("pdo/connection.php");
error_reporting(0);
$pat_id = $_GET['pat_id'];
$query = "SELECT * from `patient` WHERE pat_id='$pat_id' ";
$pt = mysqli_query($conn, $query);
while ($rows = mysqli_fetch_array($pt)) {
$pid = $rows['pat_id'];
$czid = $rows['cz_id'];
$hid = $rows['hsp_id'];
$fn = $rows['fname'];
$ln = $rows['lname'];
$adhno = $rows['aadhar_no'];
$add = $rows['address'];
$pro = $rows['proffession'];
$ph = $rows['phone'];
$age = $rows['age'];
$gen = $rows['gender'];
$dob = $rows['dob'];
$doa = $rows['doa'];
$nof = $rows['no_flymem'];
$mh = $rows['medic_hist'];
}
?>
<html>
<head>
<title>Edit Patients Record</title>
</head>
<body id="acz">
<?php include 'pdo/headers.php'; ?>
<link rel="stylesheet" href="pdo/style.css">
<h1 style="margin-left:10px;">Edit Patient Details</h1><br>
<div id="form">
<form action="" method="GET">
<div class="container">
<div class="row justify-content-center">
<div class="col-8">
<div class="row">
<div class="form group">
<label class="control-label col-md-4" for="pat_id">Patient ID* </label>
<div class="col-md-4">
<input type="text" class="form-control" name="pat_id" placeholder="enter pat_id" id="pat_id" value="<?php echo $pid ?>" /><br>
</div>
</div>
</div><br>
<div class="row">
<div class="form group">
<label class="control-label col-md-4" for="cz_id">Containment Zone ID* </label>
<div class="col-md-4">
<input type="text" class="form-control" name="cz_id" placeholder="enter cz_id" id="cz_id" value="<?php echo $czid ?>" /><br>
</div>
</div>
</div><br>
<div class="row">
<div class="form group">
<label class="control-label col-md-4" for="hsp_id">Hospital ID* </label>
<div class="col-md-4">
<input type="text" class="form-control" name="hsp_id" placeholder="enter hsp_id" id="hsp_id" value="<?php echo $hid ?>" /><br>
</div>
</div>
</div><br>
<div class="row">
<div class="form group">
<label class="control-label col-md-4" for="fname">First Name* </label>
<div class="col-md-4">
<input type="text" class="form-control" name="fname" placeholder="enter fname" id="fname" value="<?php echo $fn ?>" /><br>
</div>
</div>
</div><br>
<div class="row">
<div class="form group">
<label class="control-label col-md-4" for="lname">Last Name* </label>
<div class="col-md-4">
<input type="text" class="form-control" name="lname" placeholder="enter lname" id="lname" value="<?php echo $ln ?>" /><br>
</div>
</div>
</div><br>
<div class="row">
<div class="form group">
<label class="control-label col-md-4" for="adhno">Aadhar Number* </label>
<div class="col-md-4">
<input type="text" class="form-control" name="adhno" placeholder="enter adhno" id="adhno" value="<?php echo $adhno ?>" /><br>
</div>
</div>
</div><br>
<div class="row">
<div class="form group">
<label class="control-label col-md-4" for="addr">Address* </label>
<div class="col-md-4">
<input type="text" class="form-control" name="addr" placeholder="enter addr" id="addr" value="<?php echo $add ?>" /><br>
</div>
</div>
</div><br>
<div class="row">
<div class="form group">
<label class="control-label col-md-4" for="prof">Profession</label>
<div class="col-sm-3">
<input type="text" class="form-control" name="prof" placeholder="enter prof" id="prof" value="<?php echo $pro ?>" /><br>
</div>
</div>
</div><br>
<div class="row">
<div class="form group">
<label class="control-label col-md-4" for="phone">Phone Number* </label>
<div class="col-md-4">
<input type="text" class="form-control" name="phone" placeholder="enter phone" id="phone" value="<?php echo $ph ?>" /><br>
</div>
</div>
</div><br>
<div class="row">
<div class="form group">
<label class="control-label col-md-3" for="age">Age </label>
<div class="col-md-4">
<input type="text" class="form-control" name="age" placeholder="enter age" id="age" value="<?php echo $age ?>" />
</div>
</div>
<div class="form group ">
<label class="control-label col-md-4" for="gen">Gender </label>
<div class="col-sm-3">
<select id="gen" class="form-control" name="gen" selected="<?php echo $gen ?>">
<option value="Male" <?php if ($gen == "Male") echo 'selected="selected"'; ?>>Male</option>
<option value="Female" <?php if ($gen == "Female") echo 'selected="selected"'; ?>>Female</option>
<option value="Other" <?php if ($gen == "Other") echo 'selected="selected"'; ?>>Other</option>
</select>
</div>
</div>
</div><br>
<div class="row">
<div class="form group">
<label class="control-label col-md-4" for="dob">Date Of Birth* </label>
<div class="col-sm-3">
<input type="date" class="form-control" name="dob" placeholder="enter date_of_birth" id="dob" value="<?php echo $dob ?>" /><br>
</div>
</div>
</div><br>
<div class="row">
<div class="form group">
<label class="control-label col-md-4" for="doa">Date Of Admission* </label>
<div class="col-sm-3">
<input type="date" class="form-control" name="doa" placeholder="enter date_of_admission" id="doa" value="<?php echo $doa ?>" /><br>
</div>
</div>
</div><br>
<div class="row">
<div class="form group">
<label class="control-label col-md-4" for="nof">Number of Family Member </label>
<div class="col-md-4">
<input type="number" class="form-control" name="nof" placeholder="enter nof" id="nof" value="<?php echo $nof ?>" /><br>
</div>
</div>
</div><br>
<div class="row">
<div class="form group">
<label class="control-label col-md-4" for="mh">Medical History*</label>
<div class="col-sm-3">
<input type="text" class="form-control" name="mh" placeholder="enter mh" id="mh" value="<?php echo $mh ?>" /><br>
</div>
</div>
</div><br>
</div>
</div>
</div>
<div class="row justify-content-center">
<button type="submit" class="btn btn-primary btn-large mb-2 " style="height:35px; width:70px;font-size:15px;" name="submit" value="submit" id="submit">Update</button>
</div>
</form>
</div><br>
<?php
if ($_GET['submit']) {
$pid = $_GET['pat_id'];
$czid = $_GET['cz_id'];
$hid = $_GET['hsp_id'];
$fn = $_GET['fname'];
$ln = $_GET['lname'];
$adhno = $_GET['adhno'];
$add = $_GET['addr'];
$pro = $_GET['prof'];
$ph = $_GET['phone'];
$age = $_GET['age'];
$gen = $_GET['gen'];
$dob = $_GET['dob'];
$doa = $_GET['doa'];
$nof = $_GET['nof'];
$mh = $_GET['mh'];
if (
$pid != "" && $czid != "" && $hid != "" && $fn != "" && $ln != "" && $adhno != "" && $add != "" &&
$ph != "" && $dob != "" && $doa != "" && $nof != "" && $mh !== ""
) {
$quer = "UPDATE patient SET cz_id='$czid', hsp_id='$hid', fname='$fn',lname='$ln',aadhar_no='$adhno',address='$add',
proffession='$pro',phone='$ph',age='$age',gender='$gen', dob='$dob', doa='$doa', no_flymem='$nof',medic_hist='$mh' WHERE pat_id='$pid'";
$res = mysqli_query($conn, $quer);
if ($res) {
echo "<font color='green'><h4>DATA UPDATED SUCCESSFULLY!</h4></font>";
} else {
echo "<font color='red'><h4>SOME ERROR OCCURED!</h4></font>";
}
} else {
echo "<font color='red'><h4>* fields are required!</h4></font>";
}
} else {
echo "<h3><font color='blue'>Click on Update to update you Record</font></h3>";
}
?><br>
<button type="submit" class="btn btn-outline-secondary mb-2" style="height:35px; width:70px;font-size:15px; margin-left:10px;">
<a href="pat.php">Back</a></button>
</body>
</html>