Dharmeshdhabu Posted May 8, 2021 Share Posted May 8, 2021 (edited) I am developing hospital managment system using php. I have IPD data sheet. When I select patient it is not showing pt data as it should do. Please let me know if any coding needs to place here. I am new to PHP. Below is my code <?php //create array to temporarily grab variables $input_arr = array(); //grabs the $_POST variables and adds slashes foreach ($_POST as $key => $input_arr) { $_POST[$key] = addslashes($input_arr); } ?> <?php session_start(); $db = mysqli_connect('localhost', 'root', '', 'ratanba_new'); // initialize variables $reg_no = ""; $name = ""; $father_name = ""; $sir_name = ""; $sex = ""; $age = ""; $full_name = ""; $dob = ""; $update = false; $patient_master_id = ""; $ipd_id = 0; $IPNo = ""; $fees = ""; $opd_date = ""; $pulse = ""; $bps = ""; $bpd = ""; $weight = ""; $spo2 = ""; if (isset($_POST['admit'])) { function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); $data = ucwords($data); return $data; } $patient_master_id = $_POST['patient_master_id']; $IPNo = $_POST['IPNo']; $RegNo = $_POST['reg_no']; $Name = $_POST['Name']; $Age = $_POST['Age']; $Sex = $_POST['sex']; $Contact1 = $_POST['Contact1']; $Relation1 = $_POST['Relation1']; $Mobile1 = $_POST['Mobile1']; $Contact2 = $_POST['Contact2']; $Relation2 = $_POST['Relation2']; $Mobile2 = $_POST['Mobile2']; $Adate = $_POST['Adate']; $Award = $_POST['Award']; mysqli_query($db, "INSERT INTO IPD (IPNo, RegNo, Name, Age, Sex, Contact1, Relation1, Mobile1, Contact2, Relation2, Mobile2, Adate, Award) VALUES ('$IPNo', '$RegNo', '$Name', '$Age', '$Sex', '$Contact1', '$Relation1', '$Mobile1', '$Contact2', '$Relation2', '$Mobile2', NOW(), '$Award')"); $_SESSION['message'] = "New Admission Successfull !"; header('location: ../ipd.php'); } if (isset($_POST['Discharge'])) { $ipd_id = $_POST['ipd_id']; $Outcome = $_POST['Outcome']; mysqli_query($db, "UPDATE ipd SET Outcome='$Outcome', Ddate=NOW() WHERE ipd_id=$ipd_id"); $_SESSION['message'] = "Patient discharged Successfull !"; header('location: ../ipd.php'); } if (isset($_POST['final_discharge'])) { $ipd_id = $_POST['ipd_id']; $History = $_POST['History']; $Examination = $_POST['Examination']; $Investigation = $_POST['Investigation']; $Advise = $_POST['Advise']; $Diagnosis = $_POST['Diagnosis']; $Treatment = $_POST['Treatment']; $Operation = $_POST['Operation']; $OTnote = $_POST['OTnote']; $Condition1 = $_POST['Condition1']; $Note = $_POST['Note']; mysqli_query($db, "UPDATE ipd SET History='$History', Examination='$Examination', Investigation='$Investigation', Diagnosis='$Diagnosis', Operation='$Operation', OTnote='$OTnote', Condition1='$Condition1', Advise ='$Advise', Treatment='$Treatment', Note='$Note' WHERE ipd_id=$ipd_id"); $_SESSION['message'] = "Discharge saved Successfull !"; header('location: ../doctor/discharge.php'); } $results = mysqli_query($db, "SELECT * FROM IPD "); ?> Edited May 8, 2021 by Barand Coding was missed Quote Link to comment https://forums.phpfreaks.com/topic/312639-not-showing-data/ Share on other sites More sharing options...
NotSunfighter Posted May 8, 2021 Share Posted May 8, 2021 Dharmeshdhabu, neither of the two code samples you posted relate to the question. The first is totally useless and the second is for installing info into a database. I shall comment on the second, longer code. It's a shame SESSIONs are used to just send a message to the user and not protect data. But that may be all you need. So this is just my BS, don't worry about it. But here are two things that you should worry about You never call the function "test_input" before you insert data. I should be called before the INSERT and both UPDATES. It should be removed from the "if (isset($_POST['admit'])) {" and made to stand along. You initialize variables for the first admit of a patient, but not for "$Treatment = $_POST['Treatment'];". Be consistent. "$results = mysqli_query($db, "SELECT * FROM IPD ");" $db is never defined and where does the $results go? This might be your problem: PHP is case sensitive. You insert into IPD, but UPDATE ipd. Always use lower case for DB and field names. Quote Link to comment https://forums.phpfreaks.com/topic/312639-not-showing-data/#findComment-1586409 Share on other sites More sharing options...
Dharmeshdhabu Posted May 11, 2021 Author Share Posted May 11, 2021 On 5/8/2021 at 7:34 PM, NotSunfighter said: Dharmeshdhabu, neither of the two code samples you posted relate to the question. The first is totally useless and the second is for installing info into a database. I shall comment on the second, longer code. It's a shame SESSIONs are used to just send a message to the user and not protect data. But that may be all you need. So this is just my BS, don't worry about it. But here are two things that you should worry about You never call the function "test_input" before you insert data. I should be called before the INSERT and both UPDATES. It should be removed from the "if (isset($_POST['admit'])) {" and made to stand along. You initialize variables for the first admit of a patient, but not for "$Treatment = $_POST['Treatment'];". Be consistent. "$results = mysqli_query($db, "SELECT * FROM IPD ");" $db is never defined and where does the $results go? This might be your problem: PHP is case sensitive. You insert into IPD, but UPDATE ipd. Always use lower case for DB and field names. Thanks for your kind help. Let me describe my problem in details so that you can understand well. First I have patient list from where I can choose a patient and when I click "IPD" button it directs me to IPD page namely "http://localhost/ratanba_new/doctor/IPDTreatment.php?edit=17" and it works fine. Below is the code of that page, <?php include('../doctor/data/dailytreatment.php'); if (isset($_GET['edit'])) { $ipd_id = $_GET['edit']; $ID = $_GET['edit']; $update = true; $record = mysqli_query($db, "SELECT * FROM ipd WHERE ipd_id=$ipd_id"); if (count($record) == 1 ) { $n = mysqli_fetch_array($record); $IPNo = $n['IPNo']; $RegNo = $n['RegNo']; $Name = $n['Name']; $Age = $n['Age']; $Sex = $n['Sex']; $Adate = $n['Adate']; $Award = $n['Award']; $Ddate = $n['Ddate']; $Outcome = $n['Outcome']; $Diagnosis = $n['Diagnosis']; $History = $n['History']; $Examination = $n['Examination']; $Investigation = $n['Investigation']; $Advise = $n['Advise']; $Treatment = $n['Treatment']; $Operation = $n['Operation']; $OTnote = $n['OTnote']; $Condition1 = $n['Condition1']; $Note = $n['Note']; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <title>IPD Treatment</title> <!-- Bootstrap Core CSS --> <link href="../vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet"> <!-- MetisMenu CSS --> <link href="../vendor/metisMenu/metisMenu.min.css" rel="stylesheet"> <!-- Custom CSS --> <link href="../dist/css/sb-admin-2.css" rel="stylesheet"> <!-- Custom Fonts --> <link href="../vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"> <!-- DataTables CSS --> <link href="../vendor/datatables-plugins/dataTables.bootstrap.css" rel="stylesheet"> <!-- DataTables Responsive CSS --> <link href="../vendor/datatables-responsive/dataTables.responsive.css" rel="stylesheet"> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif]--> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> </head> <body> <div id="wrapper"> <?php include("menu.php"); ?> <div id="page-wrapper"> <!-- /.row --> <div class="row"> <form role="form" method="post" action="data/dailytreatment.php"> <div class="col-lg-12" style="padding-top:25px;"> <div class="form-group"> <input type="hidden" name="ipd_id" id="txtdob" value="<?php echo $ipd_id; ?>"> <input type="hidden" name="Name" id="txtdob" value="<?php echo $Name; ?>"> <input type="hidden" name="Sex" id="txtdob" value="<?php echo $Sex; ?>"> <input type="hidden" name="Age" id="txtdob" value="<?php echo $Age; ?>"> <input type="hidden" name="Award" id="txtdob" value="<?php echo $Award; ?>"> <input type="hidden" name="Adate" id="txtdob" value="<?php echo $Adate; ?>"> <input type="hidden" name="Complaints" id="txtdob" value="<?php echo $Complaints; ?>"> <input type="hidden" name="Findings" id="txtdob" value="<?php echo $Findings; ?>"> <input type="hidden" name="Treatment" id="txtdob" value="<?php echo $Treatment; ?>"> <input type="hidden" name="Note" id="txtdob" value="<?php echo $Note; ?>"> <label>IPD No.: </label> <input type="hidden" name="IPNo" value="<?php echo $IPNo; ?>"/> <label name="IPNo" class="blue"> <?php echo $IPNo; ?></label> | <label>Reg No.: </label> <input type="hidden" name="RegNo" id="txtdob" value="<?php echo $RegNo; ?>"> <label name="RegNo" class="blue"> <?php echo $RegNo; ?></label> | <label>Name: </label> <label name="Name" class="blue"> <?php echo $Name; ?></label> | <label>Sex: </label> <label name="Sex" class="blue"> <?php echo $Sex; ?></label> | <label>Age: </label> <label name="Age" class="blue"> <?php echo $Age; ?></label> | <label>Ward: </label> <label name="Award" class="blue"> <?php echo $Award; ?></label> | <label>Treatment Date: </label> <label class="red"><?php echo $Adate; ?></label> | <button type="submit" name="save">Save</button> <button type="submit" name="update" >Update</button> </div> </div> <div class="col-lg-12" style="padding-top:0px;"> <div class="panel panel-default"> <div class="panel-body"> <div class="row" style="margin-left: 1px;"> <div class="col-lg-6" style="BACKGROUND: #c6f3f5; "> <div class="form-group"> <label>Complaints :</label> <textarea class="form-control complains_text" id="Complaints" style="height:305px;" name="Complaints" ><?php echo $Complaints; ?></textarea> </div> <div class="form-group"> <label>Findings :</label> <textarea class="form-control findings_text" style="height:305px;" name="Findings" id="Findings"><?php echo $Findings; ?></textarea> </div> </div> <div class="col-lg-6" style="BACKGROUND: #fdf9c6 "> <div class="form-group"> <div class="form-group"> <label>Advise :</label> <textarea class="form-control advise_text" style="height:305px;" name="Advise" id="Advise"><?php echo $Advise; ?></textarea> </div> <div class="form-group"> <label style="padding-top: 10px; ">Medicine List: </label> <table width="100%"> <tr> <td width="92%"> <script> $(document).ready(function(){ $("#btn3").click(function(){ var txtm = $("#medicine_title_id").val(); var boxm = $("#medicine"); boxm.val(boxm.val() +'\n'+ txtm); }); }); </script> <input list="medicine_list" class="form-control" name="medicine_title_" id="medicine_title_id"> <?php $results = mysqli_query($db, "SELECT * FROM medicine_tbl"); ?> <datalist id="medicine_list"> <?php while ($row = mysqli_fetch_array($results)) { ?> <option value="<?php echo $row['medicine_title']; ?>"> <?php } ?> </datalist> </td> <td> </td> <td width="10%"> <button type="button" id="btn3" class="btn btn-danger btn-"><i class="fa fa-plus"></i></button> </td> </tr> </table> </div> <div class="form-group"> <label>Rx :</label> <textarea class="form-control rx_text" id="Treatment" style="height:220px;" name="Treatment"><?php echo $Treatment; ?></textarea> </div> <div class="form-group"> <label>Note :</label> <textarea class="form-control rx_text" id="Note" style="height:220px;" name="Note"><?php echo $Note; ?></textarea> </div> <!-- /.col-lg-6 (nested) --> </div> </div> </div> </form> <div class="col-lg-1" style="padding-top:30px;"> </div> <div class="col-lg-12" style="padding-top:30px;"> <div class="panel panel-default"> <div class="panel-heading"> View IPD Treatment </div> <!-- /.panel-heading --> <div class="panel-body"> <input type="hidden" name="ID" id="ID" value="<?php echo $ID; ?>"> <?php $results = mysqli_query($db, "SELECT * FROM ipdtreatment"); ?> <table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-example"> <thead> <tr> <th>IPD No</th> <TH>DATE</TH> <TH>Rx </TH> <TH>Advise </TH> <TH>Complaints </TH> <TH>Findings </TH> <th>Note</th> <TH>View</TH> <TH>EDIT</TH> </tr> </thead> <tbody> <?php while ($row = mysqli_fetch_array($results)) { ?> <tr> <td type="hidden" name="ID" id="ID"><?php echo $row['ID']; ?></td> <td><?php echo $row['IPNo']; ?></td> <th class="blue"><?php echo $row['Date']; ?></th> <th><?php echo $row['Treatment']; ?></th> <td><?php echo $row['Advise']; ?></td> <td><?php echo $row['Complaints']; ?></td> <td><?php echo $row['Findings']; ?></td> <td><?php echo $row['Note']; ?></td> <td><a class="btn btn-success" href="daily_upadate.php?view=<?php echo $row['ID']; ?>" class="edit_btn" >Edit</a></td> <td> <a class="btn btn-warning viewcomplains" target="_top" data-Complaints="<?php echo $row['Complaints']; ?>" data-Findings="<?php echo $row['Findings']; ?>" data-Advise="<?php echo $row['Advise']; ?>" data-Treatment="<?php echo $row['Treatment']; ?>" data-Note="<?php echo $row['Note']; ?>" data-Date="<?php echo $row['Date']; ?>" >Copy</a></td> </tr> <?php } ?> </tbody> <tbody> In this page I have list of IPD patients and edit button along with to edit IPD treatment. I wish to get specific patient data on clicking edit button. below is the code for the same <?php include('data/dailytreatment.php'); if (isset($_GET['edit_btn'])) { $ID = $_GET['edit_btn']; $update = true; $record = mysqli_query($db, "SELECT * FROM ipdtreatment WHERE ID=$ID"); if (count($record) == 1 ) { $n = mysqli_fetch_array($record); $IPNo = $n['IPNo']; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <title>Update IPD Treatment</title> <!-- Bootstrap Core CSS --> <link href="../vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet"> <!-- MetisMenu CSS --> <link href="../vendor/metisMenu/metisMenu.min.css" rel="stylesheet"> <!-- Custom CSS --> <link href="../dist/css/sb-admin-2.css" rel="stylesheet"> <!-- Custom Fonts --> <link href="../vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"> <!-- DataTables CSS --> <link href="../vendor/datatables-plugins/dataTables.bootstrap.css" rel="stylesheet"> <!-- DataTables Responsive CSS --> <link href="../vendor/datatables-responsive/dataTables.responsive.css" rel="stylesheet"> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif]--> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> </head> <body> <div id="wrapper"> <?php include("menu.php"); ?> <div id="page-wrapper"> <!-- /.row --> <div class="row"> <form role="form" method="post" action="data/daily_upadate.php"> <div class="col-lg-12" style="padding-top:25px;"> <div class="form-group"> <input type="hidden" name="ID" value="<?php echo $ID; ?>"/> <label>IPD No.: </label> <input type="hidden" name="IPNo" value="<?php echo $IPNo; ?>"/> <label name="IPNo" class="blue"> <?php echo $IPNo; ?></label> | <label>Reg No.: </label> <input type="hidden" name="RegNo" id="txtdob" value="<?php echo $RegNo; ?>"> <label name="RegNo" class="blue"> <?php echo $RegNo; ?></label> | <label>Name: </label> <label name="Name" class="blue"> <?php echo $Name; ?></label> | <label>Sex: </label> <label name="Sex" class="blue"> <?php echo $Sex; ?></label> | <label>Age: </label> <label name="Age" class="blue"> <?php echo $Age; ?></label> | <label>Ward: </label> <label name="Award" class="blue"> <?php echo $Award; ?></label> | <label>Treatment Date: </label> <label name="Date" class="red"><?php echo $Date; ?></label> | <button type="submit" name="save">Save</button> <button type="submit" name="update" >Update</button> </div> </div> <div class="col-lg-12" style="padding-top:0px;"> <div class="panel panel-default"> <div class="panel-body"> <div class="row" style="margin-left: 1px;"> <div class="col-lg-6" style="BACKGROUND: #c6f3f5; "> <div class="form-group"> <label>Complaints :</label> <textarea class="form-control complains_text" id="Complaints" style="height:305px;" name="Complaints" ><?php echo $Complaints; ?></textarea> </div> <div class="form-group"> <label>Findings :</label> <textarea class="form-control findings_text" style="height:305px;" name="Findings" id="Findings"><?php echo $Findings; ?></textarea> </div> </div> <div class="col-lg-6" style="BACKGROUND: #fdf9c6 "> <div class="form-group"> <div class="form-group"> <label>Advise :</label> <textarea class="form-control advise_text" style="height:305px;" name="Advise" id="Advise"><?php echo $Advise; ?></textarea> </div> <div class="form-group"> <label style="padding-top: 10px; ">Medicine List: </label> <table width="100%"> <tr> <td width="92%"> <script> $(document).ready(function(){ $("#btn3").click(function(){ var txtm = $("#medicine_title_id").val(); var boxm = $("#medicine"); boxm.val(boxm.val() +'\n'+ txtm); }); }); </script> <input list="medicine_list" class="form-control" name="medicine_title_" id="medicine_title_id"> <?php $results = mysqli_query($db, "SELECT * FROM medicine_tbl"); ?> <datalist id="medicine_list"> <?php while ($row = mysqli_fetch_array($results)) { ?> <option value="<?php echo $row['medicine_title']; ?>"> <?php } ?> </datalist> </td> <td> </td> <td width="10%"> <button type="button" id="btn3" class="btn btn-danger btn-"><i class="fa fa-plus"></i></button> </td> </tr> </table> </div> <div class="form-group"> <label>Rx :</label> <textarea class="form-control rx_text" id="Treatment" style="height:220px;" name="Treatment"><?php echo $Treatment; ?></textarea> </div> <div class="form-group"> <label>Note :</label> <textarea class="form-control rx_text" id="Note" style="height:220px;" name="Note"><?php echo $Note; ?></textarea> </div> <!-- /.col-lg-6 (nested) --> </div> </div> </div> </form> <div class="col-lg-1" style="padding-top:30px;"> </div> <div class="col-lg-12" style="padding-top:30px;"> <div class="panel panel-default"> <div class="panel-heading"> View IPD Treatment </div> <!-- /.panel-heading --> <div class="panel-body"> <input type="hidden" name="ID" id="ID" value="<?php echo $ID; ?>"> <?php $results = mysqli_query($db, "SELECT * FROM ipdtreatment"); ?> <table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-example"> <thead> <tr> <th hidden>ID</th> <th>IPD No</th> <TH>DATE</TH> <TH>Rx </TH> <TH>Advise </TH> <TH>Complaints </TH> <TH>Findings </TH> <th>Note</th> <TH>View</TH> <TH>EDIT</TH> </tr> </thead> <tbody> <?php while ($row = mysqli_fetch_array($results)) { ?> <tr> <td hidden><name="ID" ID="ID"><?php echo $row['ID']; ?></td> <td><?php echo $row['IPNo']; ?></td> <th class="blue"><?php echo $row['Date']; ?></th> <th><?php echo $row['Treatment']; ?></th> <td><?php echo $row['Advise']; ?></td> <td><?php echo $row['Complaints']; ?></td> <td><?php echo $row['Findings']; ?></td> <td><?php echo $row['Note']; ?></td> <td><a class="btn btn-success" target="_blank" href="daily_upadate.php?view=<?php echo $row['ID']; ?>" >Edit</a></td> <td> <a class="btn btn-warning viewcomplains" target="_top" data-Complaints="<?php echo $row['Complaints']; ?>" data-Findings="<?php echo $row['Findings']; ?>" data-Advise="<?php echo $row['Advise']; ?>" data-Treatment="<?php echo $row['Treatment']; ?>" data-Note="<?php echo $row['Note']; ?>" data-Date="<?php echo $row['Date']; ?>" >Copy</a></td> </tr> <?php } ?> </tbody> <tbody> </tbody> </table> <!-- /.table-responsive --> </div> <!-- /.panel-body --> </div> <!-- /.panel --> </div> <!-- /.col-lg-12 --> </div> <!-- /.row --> </div> <!-- /#page-wrapper --> </div> <!-- /#wrapper --> <!-- jQuery --> <script src="../vendor/jquery/jquery.min.js"></script> <!-- Bootstrap Core JavaScript --> <script src="../vendor/bootstrap/js/bootstrap.min.js"></script> <!-- Metis Menu Plugin JavaScript --> <script src="../vendor/metisMenu/metisMenu.min.js"></script> <!-- Custom Theme JavaScript --> <script src="../dist/js/sb-admin-2.js"></script> <script> // tooltip demo $('.tooltip-demo').tooltip({ selector: "[data-toggle=tooltip]", container: "body" }) // popover demo $("[data-toggle=popover]") .popover() </script> <!-- DataTables JavaScript --> <script src="../vendor/datatables/js/jquery.dataTables.min.js"></script> <script src="../vendor/datatables-plugins/dataTables.bootstrap.min.js"></script> <script src="../vendor/datatables-responsive/dataTables.responsive.js"></script> <!-- Page-Level Demo Scripts - Tables - Use for reference --> <script> $(document).ready(function() { $('#dataTables-example').DataTable({ responsive: true }); }); </script> <script> $("body").on("click",".viewcomplains",function(){ // alert($(this).attr("data-complains")); var complains = $(this).attr("data-complains"); $('.complains_text').val(complains); var findings = $(this).attr("data-findings"); $('.findings_text').val(findings); var advise = $(this).attr("data-advise"); $('.advise_text').val(advise); var rx = $(this).attr("data-rx"); $('.rx_text').val(rx); var clinical_note = $(this).attr("data-note"); $('.note_text').val(clinical_note); }); </script> <script> </script> </body> </html> </tbody> </table> <!-- /.table-responsive --> </div> <!-- /.panel-body --> </div> <!-- /.panel --> </div> <!-- /.col-lg-12 --> </div> <!-- /.row --> </div> <!-- /#page-wrapper --> </div> <!-- /#wrapper --> <!-- jQuery --> <script src="../vendor/jquery/jquery.min.js"></script> <!-- Bootstrap Core JavaScript --> <script src="../vendor/bootstrap/js/bootstrap.min.js"></script> <!-- Metis Menu Plugin JavaScript --> <script src="../vendor/metisMenu/metisMenu.min.js"></script> <!-- Custom Theme JavaScript --> <script src="../dist/js/sb-admin-2.js"></script> <script> // tooltip demo $('.tooltip-demo').tooltip({ selector: "[data-toggle=tooltip]", container: "body" }) // popover demo $("[data-toggle=popover]") .popover() </script> <!-- DataTables JavaScript --> <script src="../vendor/datatables/js/jquery.dataTables.min.js"></script> <script src="../vendor/datatables-plugins/dataTables.bootstrap.min.js"></script> <script src="../vendor/datatables-responsive/dataTables.responsive.js"></script> <!-- Page-Level Demo Scripts - Tables - Use for reference --> <script> $(document).ready(function() { $('#dataTables-example').DataTable({ responsive: true }); }); </script> <script> $("body").on("click",".viewcomplains",function(){ // alert($(this).attr("data-complains")); var complains = $(this).attr("data-complains"); $('.complains_text').val(complains); var findings = $(this).attr("data-findings"); $('.findings_text').val(findings); var advise = $(this).attr("data-advise"); $('.advise_text').val(advise); var rx = $(this).attr("data-rx"); $('.rx_text').val(rx); var clinical_note = $(this).attr("data-note"); $('.note_text').val(clinical_note); }); </script> <script> </script> </body> </html> This page show no error but data of specific patient is missing. What is missing has been marked as bold. Note: I have ipd table and ipdtreatment table Quote Link to comment https://forums.phpfreaks.com/topic/312639-not-showing-data/#findComment-1586472 Share on other sites More sharing options...
Dharmeshdhabu Posted May 11, 2021 Author Share Posted May 11, 2021 Below is code for dailytreatment.php <?php //create array to temporarily grab variables $input_arr = array(); //grabs the $_POST variables and adds slashes foreach ($_POST as $key => $input_arr) { $_POST[$key] = addslashes($input_arr); } ?> <?php session_start(); $db = mysqli_connect('localhost', 'root', '', 'ratanba_new'); // initialize variables $IPDNo = ""; $RegNo = ""; $Name = ""; $Age = ""; $Sex = ""; $Complaints = ""; $Findings = ""; $Treatment = ""; $Advise = ""; $Note = ""; $update = false; $ID = 0; $IPNo = ""; $RegNo = ""; $Complaints = ""; $pulse = ""; $bps = ""; $bpd = ""; $weight = ""; $spo2 = ""; $Award=""; $Date=""; if (isset($_POST['save'])) { function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); $data = ucwords($data); return $data; } $IPNo = $_POST['IPNo']; $RegNo = $_POST['RegNo']; $Name = $_POST['Name']; $Age = $_POST['Age']; $Sex = $_POST['Sex']; $Date = $_POST['Date']; $Complaints = $_POST['Complaints']; $Findings = $_POST['Findings']; $Treatment = $_POST['Treatment']; $Advise = $_POST['Advise']; $Note = $_POST['Note']; mysqli_query($db, "INSERT INTO ipdtreatment (IPNo, RegNo, Name, Age, Sex, Date, Complaints, Findings, Treatment, Advise, Note) VALUES ('$IPNo', '$RegNo', '$Name', '$Age', '$Sex', Now(), '$Complaints', '$Findings', '$Treatment', '$Advise', '$Note')"); $_SESSION['message'] = "New Admission Successfull !"; header('location: ../../ipd.php'); } $results = mysqli_query($db, "SELECT * FROM ipd "); ?> Quote Link to comment https://forums.phpfreaks.com/topic/312639-not-showing-data/#findComment-1586473 Share on other sites More sharing options...
Barand Posted May 11, 2021 Share Posted May 11, 2021 (edited) 1 ) Use code tags ("<>" button in the toolbar). I have edited your posts so far; in future I'll delete any vast tracts of code.. 2 ) Post relevant code - I doubt anyone will bother wading through all the code you posted. https://forums.phpfreaks.com/guidelines/ Edited May 11, 2021 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/312639-not-showing-data/#findComment-1586474 Share on other sites More sharing options...
NotSunfighter Posted May 11, 2021 Share Posted May 11, 2021 Clean up your code. You have 6 </html> and combine your javascript into a single file Quote Link to comment https://forums.phpfreaks.com/topic/312639-not-showing-data/#findComment-1586475 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.