|
| 1 | +<?php |
| 2 | +session_start(); |
| 3 | +?> |
| 4 | + |
| 5 | + |
| 6 | +<?php |
| 7 | +if(!$_SESSION[user]=$username){ |
| 8 | + header("location:index.html"); |
| 9 | + exit; |
| 10 | + } |
| 11 | +$dbhost = 'localhost'; |
| 12 | +$dbuser = 'root'; |
| 13 | +$dbpass = 'ikenna'; |
| 14 | +$conn = mysql_connect($dbhost, $dbuser, $dbpass); |
| 15 | +$id=$_POST['id']; |
| 16 | +$medicine=$_POST['medicine']; |
| 17 | +$diagnosis=$_POST['diagnosis']; |
| 18 | +$instructions=$_POST['instructions']; |
| 19 | +$doc_name=$_POST['doc_name']; |
| 20 | + |
| 21 | +mysql_select_db('hms'); |
| 22 | +$str="insert into prescription values('$id','$medicine','$diagnosis','$instructions','$doc_name')"; |
| 23 | +$res=@mysql_query($str)or die(mysql_error()); |
| 24 | +if(! $conn ) |
| 25 | +{ |
| 26 | + die('Could not connect: ' . mysql_error()); |
| 27 | +} |
| 28 | +$id = $_POST['id']; |
| 29 | +$sql="SELECT * FROM patients WHERE id='$id'"; |
| 30 | + |
| 31 | + |
| 32 | +$retval = mysql_query( $sql, $conn ); |
| 33 | +if(! $retval ) |
| 34 | +{ |
| 35 | + die('Could not get data: ' . mysql_error()); |
| 36 | +} |
| 37 | +while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) |
| 38 | +{ |
| 39 | + echo "<big><b>PRESCRIPTION : </b></big><br><br><br>"; |
| 40 | + echo "DOCTOR NAME : $doc_name<br>"; |
| 41 | + echo "<b>Patient Details : </b><br>"; |
| 42 | + echo "PATIENT ID : {$row['id']} <br><br> ". |
| 43 | + "NAME : {$row['name']} <br><br> ". |
| 44 | + "AGE : {$row['age']} <br><br> ". |
| 45 | + "GENDER : {$row['gender']} <br><br> ". |
| 46 | + "MOBILE : {$row['mobile']} <br><br> ". |
| 47 | + |
| 48 | + "--------------------------------<br>"; |
| 49 | +} |
| 50 | +echo "MEDICINE : $medicine <br><br>". |
| 51 | + "DIAGNOSIS : $diagnosis <br><br>". |
| 52 | + "ADDITIONAL INSTRUCTIONS : $instructions <br><br>". |
| 53 | + "--------------------------------<br>"; |
| 54 | +mysql_close($conn); |
| 55 | +?> |
| 56 | +<html> |
| 57 | +<input type="button" onClick="window.print();" value="Print Prescription"/><br><br> |
| 58 | +<a href="home.html"><b>HOME</b></a> |
| 59 | +</html> |
0 commit comments