-
Notifications
You must be signed in to change notification settings - Fork 0
/
generateprescription.php
50 lines (46 loc) · 1.46 KB
/
generateprescription.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
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'yogi123';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
$id=$_POST['id'];
$medicine=$_POST['medicine'];
$diagnosis=$_POST['diagnosis'];
$instructions=$_POST['instructions'];
$doc_name=$_POST['doc_name'];
mysql_select_db('hms');
$str="insert into prescription values('$id','$medicine','$diagnosis','$instructions','$doc_name')";
$res=@mysql_query($str)or die(mysql_error());
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
$id = $_POST['id'];
$sql="SELECT * FROM patients WHERE id='$id'";
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_array($retval, MYSQL_ASSOC))
{
echo "<big><b>PRESCRIPTION : </b></big><br><br><br>";
echo "DOCTOR NAME : $doc_name<br>";
echo "<b>Patient Details : </b><br>";
echo "PATIENT ID : {$row['id']} <br><br> ".
"NAME : {$row['name']} <br><br> ".
"AGE : {$row['age']} <br><br> ".
"GENDER : {$row['gender']} <br><br> ".
"MOBILE : {$row['mobile']} <br><br> ".
"--------------------------------<br>";
}
echo "MEDICINE : $medicine <br><br>".
"DIAGNOSIS : $diagnosis <br><br>".
"ADDITIONAL INSTRUCTIONS : $instructions <br><br>".
"--------------------------------<br>";
mysql_close($conn);
?>
<html>
<input type="button" onclick="window.print();" value="Print Prescription"/><br><br>
<a href="home.html"><b>HOME</b></a>
</html>