-
Notifications
You must be signed in to change notification settings - Fork 0
/
patientdetail.php
151 lines (147 loc) · 4.58 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
<?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]))
{
?>
<form method="post" action="" name="frmpatdet" onSubmit="return validateform()">
<table width="808" border="1">
<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 width="808" border="1">
<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>