-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
236 lines (216 loc) · 6.62 KB
/
test.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
<?php
include("includes/header.php");
include("includes/conn.php");
$resultq = mysqli_query($con,"SELECT * FROM appointment where app_id = $_GET[appid]");
$rowsapprec = mysqli_fetch_array($resultq);
echo mysqli_num_rows($resultq);
$sph = array($_POST[lsph],$_POST[rsph]);
$cyl = array($_POST[lcyl],$_POST[rcyl]);
$axis = array($_POST[laxis],$_POST[raxis]);
$arraysph = serialize($sph);
$arraycyl = serialize($cyl);
$arrayaxis = serialize($axis);
if(isset($_POST[token]) && $_POST[token] == $_SESSION[token])
{
if(isset($_POST[submit]))
{
$ins = "INSERT INTO test (app_id,sph,cyl,axis,remarks,specs_req) VALUES ($rowsapprec[app_id],$arraysph,$arraycyl,$arrayaxis,$_POST[remarks],$_POST[req])";
if (!mysqli_query($con,$ins))
{
die(Error: . mysqli_error($con));
}
$insi = mysqli_insert_id($con);
mysqli_query($con,"UPDATE appointment SET status=Done
where app_id=$_GET[appid]");
if(mysqli_affected_rows($con) == 1)
{
$rcsucc = "Test Details saved successfully..";
}
}
unset($_SESSION[token]);
}
$new_token = md5(time() . rand(0,100));
$_SESSION[token] = $new_token;
?>
<div id="templatemo_main">
<div id="sidebar" class="float_l">
<div class="sidebar_box"><span class="bottom"></span>
<?php
include("sidebar.php");
doctorhome();
?>
</div>
</div>
<div id="content" class="float_r">
<h2>Add Test Results</h2>
<?php echo $rcsucc;?>
<script type="application/javascript" >
function validation()
{
if(document.form1.lsph.value == "")
{
alert("Enter Left Eye SPH Value. ");
document.form1.lsph.focus();
return false;
}
if(document.form1.lcyl.value == "")
{
alert("Enter Left Eye CYL Value. ");
document.form1.lcyl.focus();
return false;
}
if(document.form1.laxis.value == "")
{
alert("Enter Left Eye Axis Value. ");
document.form1.laxis.focus();
return false;
}
if(document.form1.rsph.value == "")
{
alert("Enter Right Eye SPH Value. ");
document.form1.rsph.focus();
return false;
}
if(document.form1.rcyl.value == "")
{
alert("Enter Right Eye CYL Value.");
document.form1.rcyl.focus();
return false;
}
if(document.form1.raxis.value == "")
{
alert("Enter Right Eye Axis Value. ");
document.form1.raxis.focus();
return false;
}
if(document.form1.remarks.value == "")
{
alert("Enter Remarks. ");
document.form1.remarks.focus();
return false;
}
if(document.form1.req.value=="")
{
alert("Confirm Specs Requirement.");
document.form1.req.focus();
return false;
}
}
</script>
<form id="form1" name="form1" method="post" action="" onSubmit="return validation()">
<input type="hidden" name="token" value="<?=$new_token;?>"/>
<p>
<label for="fname2" class="left"> </label>
</p>
<?php
if(isset($_POST[submit]))
{
?>
<a href="prescription.php?testi=<?php echo $insi; ?>">Add prescription records</a>
<?php
}
else
{
?>
<table width="604" border="0">
<tr>
<td>Appointment ID </td>
<td> </td>
<td>
<?php echo $rowsapprec[app_id]; ?></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="131" colspan="2"><label for="patname">Patient Name:</label></td>
<td width="165"><?php
$resultq1 = mysqli_query($con,"SELECT * FROM patient where pat_id = $rowsapprec[pat_id]");
$rowsapprec1 = mysqli_fetch_array($resultq1);
echo $rowsapprec1[pat_name];
?></td>
<td width="133">Doctor Name:</td>
<td width="157"><?php
$resultq2 = mysqli_query($con,"SELECT * FROM doctor where doc_id = $rowsapprec[doc_id]");
$rowsapprec2 = mysqli_fetch_array($resultq2);
echo $rowsapprec2[doc_name];
echo "</td>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row[fname] . "</td>";
echo "<td>" . $row[lname] . "</td>";
echo "<td>" . $row[gender] . "</td>";
echo "<td>" . $row[dob] . "</td>";
echo "<td>" . $row[contact] . "</td>";
echo "</tr>";
}
?>
</table>
<p></p>
<table width="634" border="0">
<tr bgcolor="#FFFFCC">
<td colspan="2" align="center">Left Eye</td>
<td colspan="2" align="center">Right Eye</td>
</tr>
<tr bgcolor="#FFFFCC">
<td width="81">SPH:</td>
<td width="197"><label for="lsph"></label>
<label for="lsph"></label>
<input type="text" name="lsph" id="lsph" /></td>
<td width="184">SPH:</td>
<td width="154"><input type="text" name="rsph" id="rsph" /></td>
</tr>
<tr bgcolor="#FFFFCC">
<td>CYL:</td>
<td><input type="text" name="lcyl" id="lcyl" /></td>
<td>CYL:</td>
<td><input type="text" name="rcyl" id="rcyl" /></td>
</tr>
<tr bgcolor="#FFFFCC">
<td>Axis:</td>
<td><input type="text" name="laxis" id="laxis" /></td>
<td>Axis:</td>
<td><input type="text" name="raxis" id="raxis" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Remarks:</td>
<td><label for="remarks"></label>
<textarea name="remarks" id="remarks" cols="30" rows="2"></textarea></td>
<td>Specs Requirement:</td>
<td><label for="req"></label>
<select name="req" id="req">
<option value="">Select</option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="submit" id="submit" value="Save Test Results" /></td>
<td align="center"> </td>
<td align="center"> </td>
</tr>
</table>
<?php
}
?>
<p> </p>
<p> </p>
</form>
<h1> </h1>
<p> </p>
</form>
</form>
</div>
</div>
<div class="cleaner"></div>
</div>
<?php
include("includes/footer.php");
?>