Server IP : 162.240.98.243 / Your IP : 18.221.254.61 Web Server : Apache System : Linux server.bti.yaw.mybluehostin.me 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : btiyawmy ( 1003) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/btiyawmy/www/login.easenup.in/ |
Upload File : |
<?php include("header.php"); include("dbconnection.php"); if(isset($_POST[submit])) { if(isset($_GET[editid])) { $sql ="UPDATE prescription SET treatment_records_id='$_POST[treatmentid]',doctorid='$_POST[select2]',patientid='$_POST[patientid]',prescriptiondate='$_POST[date]',status='$_POST[select]' WHERE prescription_id='$_GET[editid]'"; if($qsql = mysqli_query($con,$sql)) { echo "<script>alert('prescription record updated successfully...');</script>"; } else { echo mysqli_error($con); } } else { $sql ="INSERT INTO prescription(treatment_records_id,doctorid,patientid,prescriptiondate,status,appointmentid,problem) values('$_POST[treatmentid]','$_POST[select2]','$_POST[patientid]','$_POST[date]','Active','$_GET[appid]','$_POST[problem]')"; if($qsql = mysqli_query($con,$sql)) { $insid= mysqli_insert_id($con); $prescriptionid= $insid; $prescriptiondate= $_POST[date]; $billtype="Prescription charge"; $billamt=0; include("insertbillingrecord.php"); echo "<script>alert('prescription record inserted successfully...');</script>"; echo "<script>window.location='prescriptionrecord.php?prescriptionid=" . $insid . "&patientid=$_GET[patientid]&appid=$_GET[appid]';</script>"; } else { echo mysqli_error($con); } } } if(isset($_GET[editid])) { $sql="SELECT * FROM prescription WHERE prescriptionid='$_GET[editid]' "; $qsql = mysqli_query($con,$sql); $rsedit = mysqli_fetch_array($qsql); } ?> <?php include("menu.php"); ?> <style> form{ margin: 20px 0; } form input, button{ padding: 5px; } table{ width: 100%; margin-bottom: 20px; border-collapse: collapse; } table, th, td{ border: 1px solid #cdcdcd; } table th, table td{ padding: 10px; text-align: left; } <style> table{ border: solid 1px gray; width: 100%; } input{ width: 100%;} </style> </style> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1>Add New Prescription</h1> <form method="post" action="" name="frmpres" onSubmit="return validateform()"> <input type="hidden" name="patientid" value="<?php echo $_GET[patientid]; ?>" /> <input type="hidden" name="treatmentid" value="<?php echo $_GET[treatmentid]; ?>" /> <input type="hidden" name="appid" value="<?php echo $_GET[appid]; ?>" /> <table class="center" border="1"> <tbody> <tr> <td>Patient</td> <td> <?php $sqlpatient= "SELECT * FROM patient WHERE status='Active' AND patientid='$_GET[patientid]'"; $qsqlpatient = mysqli_query($con,$sqlpatient); while($rspatient=mysqli_fetch_array($qsqlpatient)) { echo "$rspatient[patientid]- $rspatient[patientname]"; } ?></td> </tr> <?php if(isset($_SESSION[patientid])) { ?> <tr> <td>Healthcare Provider</td> <?php $sqldoctor= "SELECT * FROM admin WHERE admin.user_email_status='verified' admin.adminid='$_SESSION[adminid]'"; $qsqldoctor = mysqli_query($con,$sqldoctor); while($rsdoctor = mysqli_fetch_array($qsqldoctor)) { echo "$rsdoctor[adminname]"; } ?> <input type="hidden" name="select2" value="<?php echo $_SESSION[adminid]; ?>"/> </td> <?php } else { ?> <tr> <td width="34%">Helthcare Provider</td> <td width="66%"><select name="select2" id="select2"> <option value="">Select</option> <?php $sqldoctor= "SELECT * FROM admin WHERE user_email_status='verified'"; $qsqldoctor = mysqli_query($con,$sqldoctor); while($rsdoctor = mysqli_fetch_array($qsqldoctor)) { if($rsdoctor[adminid] == $rsedit[adminname]) { echo "<option value='$rsdoctor[adminid]' selected>$rsdoctor[adminid]-$rsdoctor[adminname]</option>"; } else { echo "<option value='$rsdoctor[adminid]'>$rsdoctor[adminid]-$rsdoctor[adminname]</option>"; } } ?> </select></td> </tr> </select></td> </tr> <?php } ?> <tr> <td>Problem</td> <td><input type="text" name="problem" id="problem" value="<?php echo $rsedit[problem]; ?>" /></td> </tr> <tr> <tr> <td>Prescription Date</td> <td><input type="date" name="date" id="date" value="<?php echo $rsedit[prescriptiondate]; ?>" /></td> </tr> <tr> <td colspan="2" align="center"><input onClick="redirect()" type="submit" name="submit" id="submit" value="Submit" /></td> </tr> </tbody> </table> <p> </p> </div> <div class="clear"></div> </div> </div> <?php include("footer.php"); ?> <script type="application/javascript"> function validateform() { if(document.frmpres.select2.value == "") { alert("Doctor name should not be empty.."); document.frmpres.select2.focus(); return false; } else if(document.frmpres.select3.value == "") { alert("Patient name should not be empty.."); document.frmpres.select3.focus(); return false; } else if(document.frmpres.date.value == "") { alert("Prescription date should not be empty.."); document.frmpres.date.focus(); return false; } else if(document.frmpres.select.value == "" ) { alert("Kindly select the status.."); document.frmpres.select.focus(); return false; } else { return true; } } </script>