-
Notifications
You must be signed in to change notification settings - Fork 0
/
patientdetail.php
225 lines (213 loc) · 7.96 KB
/
patientdetail.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
<?php
include("dbconnection.php");
if(isset($_POST['submitpat']))
{
$sql ="INSERT INTO patient(patientname,admissiondate,admissiontime,address,mobileno,gender,dob) values('$_POST[patientname]','$_POST[admissiondate]','$_POST[admissiontime]','$_POST[address]','$_POST[mobilenumber]','$_POST[select]','$_POST[dateofbirth]')";
if($qsql = mysqli_query($con,$sql))
{
echo "<script>alert('patients record inserted successfully...');</script>";
}
else
{
echo mysqli_error($con);
}
}
if(isset($_GET['editid']))
{
$sql="SELECT * FROM patient WHERE patientid='$_GET[editid]' ";
$qsql = mysqli_query($con,$sql);
$rsedit = mysqli_fetch_array($qsql);
}
?>
<?php
if(!isset($_GET['patientid']))
{
?>
<div class="container-fluid">
<div class="block-header">
<h2>Book Appointment</h2>
</div>
<div class="row clearfix">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="card">
<div class="body">
<div class="row clearfix">
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<div class="form-line">
<input type="text" name="patientname" id="patientname"/>
</div>
</div>
</div>
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<div class="form-line">
<input type="text" name="patientid" id="patientid" />
</div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-3 col-xs-12">
<div class="form-group">
<div class="form-line">
<textarea name="address" id="address" cols="45" rows="5"> </textarea>
</div>
</div>
</div>
<div class="col-sm-3 col-xs-12">
<div class="form-group drop-custum">
<select class="form-control show-tick">
<option value="">-- Gender --</option>
<option value="10">Male</option>
<option value="20">Female</option>
</select>
</div>
</div>
<div class="col-sm-3 col-xs-12">
<div class="form-group">
<div class="form-line">
<input type="text" name="mobilenumber" id="mobilenumber"/>
</div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-12">
<div class="form-group">
<div class="form-line">
<input type="date" name="dateofbirth" id="dateofbirth" />
</div>
</div>
</div>
<div class="col-sm-12">
<input type="submit" class="btn btn-raised" name="submitpat" id="submitpat" value="Submit" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<form method="post" action="" name="frmpatdet" onSubmit="return validateform()">
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td width="17%"><strong>Patient Name </strong></td>
<td width="41%"><input type="text" name="patientname" id="patientname"/></td>
<td width="16%"><strong>Patient ID</strong></td>
<td width="26%"><input type="text" name="patientid" id="patientid" /></td>
</tr>
<tr>
<td><strong>Address</strong></td>
<td align="right"><textarea name="address" id="address" cols="45" rows="5"> </textarea></td>
<td><strong>Gender</strong></td>
<td><label for="select"></label>
<select name="select" id="select">
<option value="">Select</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select></td>
</tr>
<tr>
<td><strong>Contact Number</strong></td>
<td><input type="text" name="mobilenumber" id="mobilenumber"/></td>
<td><strong>Date Of Birth </strong></td>
<td><input type="date" name="dateofbirth" id="dateofbirth" /></td>
</tr>
<tr>
<td colspan="4" align="center"><input type="submit" name="submitpat" id="submitpat" value="Submit" /></td>
</tr>
</tbody>
</table>
</form>
<?php
}
else
{
$sqlpatient = "SELECT * FROM patient where patientid='$_GET[patientid]'";
$qsqlpatient = mysqli_query($con,$sqlpatient);
$rspatient=mysqli_fetch_array($qsqlpatient);
?>
<table class="table table-bordered table-striped">
<tbody>
<tr>
<td width="16%"><strong>Patient Name </strong></td>
<td width="34%"> <?php echo $rspatient['patientname']; ?></td>
<td width="16%"><strong>Patient ID</strong></td>
<td width="34%"> <?php echo $rspatient['patientid']; ?></td>
</tr>
<tr>
<td><strong>Address</strong></td>
<td> <?php echo $rspatient['address']; ?></td>
<td><strong>Gender</strong></td>
<td> <?php echo $rspatient['gender'];?></td>
</tr>
<tr>
<td><strong>Contact Number</strong></td>
<td> <?php echo $rspatient['mobileno']; ?></td>
<td><strong>Date Of Birth </strong></td>
<td> <?php echo $rspatient['dob']; ?></td>
</tr>
</tbody>
</table>
<?php
}
?>
<script type="application/javascript">
function validateform()
{
if(document.frmpatdet.patientname.value == "")
{
alert("Patient name should not be empty..");
document.frmpatdet.patientname.focus();
return false;
}
else if(document.frmpatdet.patientid.value == "")
{
alert("Patient ID should not be empty..");
document.frmpatdet.patientid.focus();
return false;
}
else if(document.frmpatdet.admissiondate.value == "")
{
alert("Admission date should not be empty..");
document.frmpatdet.admissiondate.focus();
return false;
}
else if(document.frmpatdet.admissiontime.value == "")
{
alert("Admission time should not be empty..");
document.frmpatdet.admissiontime.focus();
return false;
}
else if(document.frmpatdet.address.value == "")
{
alert("Address should not be empty..");
document.frmpatdet.address.focus();
return false;
}
else if(document.frmpatdet.select.value == "")
{
alert("Gender should not be empty..");
document.frmpatdet.select.focus();
return false;
}
else if(document.frmpatdet.mobilenumber.value == "")
{
alert("Contact number should not be empty..");
document.frmpatdet.mobilenumber.focus();
return false;
}
else if(document.frmpatdet.dateofbirth.value == "")
{
alert("Date Of Birth should not be empty..");
document.frmpatdet.dateofbirth.focus();
return false;
}
else
{
return true;
}
}
</script>