Copy data from table and paste into text area

Ask about general coding issues or problems here.

Moderators: gesf, Michalio

Post Reply
Dharmeshdhabu
New php-forum User
New php-forum User
Posts: 21
Joined: Sat Jul 23, 2022 6:45 pm

I have a table in php page and it has two columns. One is for edit which brings all data and echo in text area as required. I have another button copy where I wish to copy only four columns and wants to keep rest of data as such. My code is given below. Edit buttons works fine but copy is not working. Nothings happens on pressing copy button. Please guide me.

Code: Select all

  <div class="panel-body">
							<?php $results = mysqli_query($conn, "SELECT * FROM bdaily where RegNo='$RegNo'"); ?>
                            <table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-example">
                                <thead>
                                    <tr>
                                       
                                        <TH>DATE</TH>
										<TH>Pulse </TH>
										<TH>BP </TH>
										<TH>Weight </TH>
										<th>CASE TYPE</th>
                                        <TH>View</TH>                                       
										<TH>Copy</TH>
										
                                    </tr>
                                </thead>
								
								<tbody>
				<?php while ($row = mysqli_fetch_array($results)) { ?>
					<tr>
						
						<th class="blue"><?php echo $row['Date']; ?></th>
						<th><?php echo $row['Pulse']; ?></th>
						<td><?php echo $row['BPS']; ?>/<?php echo $row['BPD']; ?></td>
						<td><?php echo $row['Weight']; ?></td>
						<td><?php echo $row['Caseo']; ?></td>
						<td><a class="btn btn-success"  href="clinical.php?view=<?php echo $row['ID']; ?>"  >View</a></td>
						<td>
						<a class="btn btn-warning viewcomplaints" target="_top"  
						
						data-Complaints="<?php echo $row['Complaints']; ?>" 
						data-Findings="<?php echo $row['Findings']; ?>"
						data-Advise="<?php echo $row['Advise']; ?>"
						data-Treatment1="<?php echo $row['Treatment1']; ?>"
						
						>Copy</a></td>
						
					</tr>
				<?php } ?>
				</tbody>
								
                                <tbody>
                                   

                                </tbody>
                            </table>
User avatar
Michalio
Moderator
Moderator
Posts: 265
Joined: Sun Jul 18, 2021 1:33 pm
Location: Poland

Code: Select all

<?php
$results = mysqli_query($conn, "SELECT * FROM bdaily where RegNo='$RegNo'");
?>
You should not pass variables in that way, it is very dangerous. Use the mysqli_prepare function (https://www.php.net/manual/en/mysqli.prepare.php).

Code: Select all

    <td>
        <a class="btn btn-warning viewcomplaints" target="_top"  
        data-Complaints="<?php echo $row['Complaints']; ?>" 
        data-Findings="<?php echo $row['Findings']; ?>"
        data-Advise="<?php echo $row['Advise']; ?>"
        data-Treatment1="<?php echo $row['Treatment1']; ?>"
        >Copy</a></td>
How do you want to copy these data? The anchor should have a href attribute, but the more secure way is creating a form that sends the data in POST request to create a new entry with the data from existing one
Free coding lessons: https://php-forum.com/phpforum/viewtopic.php?t=29852
Dharmeshdhabu
New php-forum User
New php-forum User
Posts: 21
Joined: Sat Jul 23, 2022 6:45 pm

I don't know how to add href. If I use it, all data are changed. I want data from two different rows means, patient name, Pulse, BP, Weight of one row suppose of today and complaints, findings etc of past date. So I want to keep Name, BP etc as such and copy complaints, findings etc from another row.Please guide me.
User avatar
Michalio
Moderator
Moderator
Posts: 265
Joined: Sun Jul 18, 2021 1:33 pm
Location: Poland

Can you show the code how are you adding a new record?
Free coding lessons: https://php-forum.com/phpforum/viewtopic.php?t=29852
Dharmeshdhabu
New php-forum User
New php-forum User
Posts: 21
Joined: Sat Jul 23, 2022 6:45 pm

Michalio wrote: Sun Sep 11, 2022 6:36 am Can you show the code how are you adding a new record?
Below is my code to insert new data.

Code: Select all

$sql = "INSERT INTO bdaily ( RegNo, PatientName, Age, Sex, Pulse, BPS, BPD, Weight, Caseo, Date, CAmount, Status, Total) VALUES ('$RegNo', '$PatientName', '$Age', '$Sex', '$Pulse', '$BPS', '$BPD', '$Weight', '$Caseo', '$Datec', '$CAmount', '$Status', '$CAmount')"; 
		$result=mysqli_query($conn,$sql) or die( "Patient registration failed!".mysqli_error($conn)); 
	
At this time I am not inserting complaints etc and keep them null. At another page I add complaints etc with below code.

Code: Select all

$sql = "UPDATE bdaily SET Findings='$Findings', Complaints='$Complaints', Treatment1='$OTreatment', Advise='$Advise', Diagnosis='$Diagnosis' WHERE ID=$ID";
		
		$results=mysqli_query($conn,$sql) or die( "Patient registration failed!".mysqli_error($conn)); 
		
User avatar
Michalio
Moderator
Moderator
Posts: 265
Joined: Sun Jul 18, 2021 1:33 pm
Location: Poland

Putting the variables directly to the query is very insecure, read about SQL Injection.
To copy the record you can use the code that you added for inserting new record.
You should have a form like that:

Code: Select all

<form method="POST" action="/record/new">
<input type="text" name="PatientName">
<!---
more fields
-->
<input type="submit" value="Add new record">
</form>
you can add a "hidden form":

Code: Select all

<form method="POST" action="/record/new">
<input type="hidden" name="PatientName" value="<?php echo $existingRecord['PatientName']; ?>">
<!---
more fields
-->
<input type="submit" value="Copy the record">
</form>
then the user will see only the button and after he click it then the form will send the record's data to make a copy of it
Free coding lessons: https://php-forum.com/phpforum/viewtopic.php?t=29852
Dharmeshdhabu
New php-forum User
New php-forum User
Posts: 21
Joined: Sat Jul 23, 2022 6:45 pm

Michalio wrote: Mon Sep 12, 2022 2:45 am Putting the variables directly to the query is very insecure, read about SQL Injection.
To copy the record you can use the code that you added for inserting new record.
You should have a form like that:

Code: Select all

<form method="POST" action="/record/new">
<input type="text" name="PatientName">
<!---
more fields
-->
<input type="submit" value="Add new record">
</form>
you can add a "hidden form":

Code: Select all

<form method="POST" action="/record/new">
<input type="hidden" name="PatientName" value="<?php echo $existingRecord['PatientName']; ?>">
<!---
more fields
-->
<input type="submit" value="Copy the record">
</form>
then the user will see only the button and after he click it then the form will send the record's data to make a copy of it
[/quote]

I tried your suggestion various ways but I am totally confused and unable to utilise it.  I don't know how to use your suggestion in my code. Please guide me.
About sql injection, I went through it. I understood that someone can still data this way but I don't have any such sensitive data for someone to still. Also I keep a copy of it at certain interval for my safety. So at present I don't think it is a practical threat at this point. Still I will keep it in mind any will try to improve it. My present concern it to copy data and paste into text area. Please help me.
Dharmeshdhabu
New php-forum User
New php-forum User
Posts: 21
Joined: Sat Jul 23, 2022 6:45 pm

I tried your suggestion various ways but I am totally confused and unable to utilise it. I don't know how to use your suggestion in my code. Please guide me.
About sql injection, I went through it. I understood that someone can still data this way but I don't have any such sensitive data for someone to still. Also I keep a copy of it at certain interval for my safety. So at present I don't think it is a practical threat at this point. Still I will keep it in mind any will try to improve it. My present concern it to copy data and paste into text area. Please help me.
User avatar
Michalio
Moderator
Moderator
Posts: 265
Joined: Sun Jul 18, 2021 1:33 pm
Location: Poland

You have PatientName, Age, Sex, Pulse, etc, these are sensitive data. You want to copy the data to the textarea, but in the code that you posted there is no textarea. It is hard to help if you have insufficient information
Free coding lessons: https://php-forum.com/phpforum/viewtopic.php?t=29852
Dharmeshdhabu
New php-forum User
New php-forum User
Posts: 21
Joined: Sat Jul 23, 2022 6:45 pm

Michalio wrote: Mon Sep 19, 2022 6:34 am You have PatientName, Age, Sex, Pulse, etc, these are sensitive data. You want to copy the data to the textarea, but in the code that you posted there is no textarea. It is hard to help if you have insufficient information
Well I gave only relevant code to avoid confusion but if you need I am providing you the whole page a bit long one. Please help me.

Code: Select all

<?php 
include('clinical_data.php');



	if (isset($_GET['view'])) {
		$ID = $_GET['view'];
		$update = true;
		
		$record = mysqli_query($conn, "SELECT * FROM bdaily WHERE ID=$ID");

		//if (count($record) == 1 ) {
			$n = mysqli_fetch_array($record);
			$ID = $n['ID'];
			$RegNo = $n['RegNo'];
			$PatientName = $n['PatientName'];
			$Caseo = $n['Caseo'];
			$Sex = $n['Sex'];
			$Age = $n['Age'];
			$Pulse = $n['Pulse'];
			$BPS = $n['BPS'];
			$BPD = $n['BPD'];
			$Weight = $n['Weight'];
			$Complaints = $n['Complaints'];
			$Findings = $n['Findings'];
			$Diagnosis = $n['Diagnosis'];
			$Treatment1 = $n['Treatment1'];
			$Advise = $n['Advise'];
			$Status = $n['Status'];
			$Certificate = $n['Certificate'];
			
			
			$Caseo = $n['Caseo'];
			
			$Date = $n['Date'];
			
		

	}
		
?>




<!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>Investigations</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="styletabel">

    <!-- DataTables Responsive CSS -->
    <link href="vendor/datatables-responsive/dataTables.responsive.css" rel="styletabel">
	 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
	 <script src="https://cdn.ckeditor.com/4.15.1/standard/ckeditor.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="">
			 <?php
			 if (isset($_POST['bill_save'])) {
		
			
			
			
	
		if (isset($_POST['update'])) {
			$ID = $_POST['ID'];
			$Findings = $_POST['Findings'];
			$Advise = $_POST['Advise'];
			$OTreatment = $_POST['OTreatment'];
			$Diagnosis = $_POST['Diagnosis'];
			$Complaints = $_POST['Complaints'];
			$Status = "P";
			$Reminder = $_POST['Reminder'];
			$Note1 = $_POST['Note1'];
			$RegNo = $_POST['RegNo'];
			$Certificate = $_POST['Certificate'];
			

		$sql = "UPDATE bdaily SET Findings='$Findings', Complaints='$Complaints', Treatment1='$OTreatment', Advise='$Advise', Diagnosis='$Diagnosis', Status='$Status', Certificate='$Certificate' WHERE ID=$ID";
		
		$results=mysqli_query($conn,$sql) or die( "Patient registration failed!".mysqli_error($conn)); 
		
		$sql = "UPDATE newregistration SET Note1='$Note1', Reminder='$Reminder'  WHERE RegNo='$RegNo'";
		$results=mysqli_query($conn,$sql) or die( "Patient registration failed!".mysqli_error($conn)); 
	
		
		
		$_SESSION['message'] = "Clinical Entry Updated !";
		
		
		
		
	}

	if (isset($_POST['Ix'])) {
			$ID = $_POST['ID'];
			$Findings = $_POST['Findings'];
			$Advise = $_POST['Advise'];
			$OTreatment = $_POST['OTreatment'];
			$Diagnosis = $_POST['Diagnosis'];
			$Complaints = $_POST['Complaints'];
			$Status = "I";
			$Reminder = $_POST['Reminder'];
			$Note1 = $_POST['Note1'];
			$RegNo = $_POST['RegNo'];
			$Certificate = $_POST['Certificate'];
			
		$sql = "UPDATE bdaily SET Findings='$Findings', Complaints='$Complaints', Treatment1='$OTreatment', Advise='$Advise', Diagnosis='$Diagnosis', Status='$Status' WHERE ID=$ID";
		
		$results=mysqli_query($conn,$sql) or die( "Patient registration failed!".mysqli_error($conn)); 
		
		$sql = "UPDATE newregistration SET Reminder='$Reminder', Note1='$Note1' WHERE RegNo='$RegNo'";
		$results=mysqli_query($conn,$sql) or die( "Patient registration failed!".mysqli_error($conn)); 
	
		
	
		
		$_SESSION['message'] = "Clinical Entry Updated !";
		
	 
		
	}

	?>
			<div class="col-lg-12" style="padding-top:25px;"> 
					<div class="form-group">
							
							<?php 
									//$dir = 'Reports/'.$RegNo.' ' ;
									 //echo '<p><a href='. $dir .' ></p>' ;
									 //echo '<p><a href="\\192.168.1.120\d\Repo">Open folder</a></p>' ;
									
								 
								//?>
                            <label>Reg No.: </label>
                            <label name="RegNo" class="blue"> <?php echo $RegNo; ?></label>
                            &nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;
							<label>Name: </label>
                            <label name="PatientName" class="blue"> <?php echo $PatientName; ?></label>
							&nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;				
							<label>Sex: </label>
                            <label name="Sex" class="blue"> <?php echo $Sex; ?></label>
							&nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;			
							<label>Age: </label>
                            <label name="Age" class="blue"> <?php echo $Age; ?></label>
							&nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;			
							<label>Case Type: </label>
                            <label name="Caseo" class="blue"> <?php echo $Caseo; ?></label>
							&nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;	
							<label>Date: </label>
                            <label name="Date" class="blue"> <?php echo $Date; ?></label>
							&nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;	
							<label>Address: </label>
                            <label name="City" class="blue"> <?php echo $CityVillage; ?>, <?php echo $Taluka; ?>, <?php echo $District; ?></label>
							
																						
							
							<br>
							<label>Pulse </label>
                            <label name="Pulse" class="red"> <?php echo $Pulse; ?> /minute</label>
							&nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;	
							<label>BP: </label>
                            <label name="BPS" class="red"> <?php echo $BPS; ?>/<?php echo $BPD; ?> mmHg</label>
							&nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;	
							<label>Weight: </label>
                            <label name="Weight" class="red"> <?php echo $Weight; ?>Kg</label>
							&nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;	
							<label>Investigation: </label>													
							<label name="Ix" class="red"> <?php echo $Pathology; ?> <?php echo $Xray; ?> <?php echo $Electrodiagnostics; ?> <?php echo $Physiotherapy; ?> <?php echo $Treatment; ?> <?php echo $CTscan; ?></label>
							&nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;	
							<label>Ix Amount: </label>													
							<label name="Amount" class="red"> <?php echo $TotalIx; ?></label>
							&nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;	
							<label>Total: </label>													
							<label name="Ix" class="red"> <?php echo $Total; ?></label>
							&nbsp;&nbsp;&nbsp; | &nbsp;&nbsp;&nbsp;	
							
							<td  width="25%" align="right">
													
													<a class="btn btn-danger" href="clinical_print.php?view=<?php echo $ID; ?>" class="view_btn" >Print</a>
													
												</td>
												
							
										
										<?php 

										$month = date('m');
										$day = date('d');
										$year = date('Y');

										$clinical_date = $day . '-' . $month . '-' . $year;
										?>
										<input type="hidden" value="<?php echo $clinical_date; ?>"  id="clinical_date" name="clinical_date" >
																			
										
										<input type="hidden" name="ID" value="<?php echo $ID; ?>">
										<input type="hidden" name="RegNo" value="<?php echo $RegNo; ?>">
										<input type="hidden" name="Caseo" value="<?php echo $Caseo; ?>">
										<input type="hidden" name="PatientName" value="<?php echo $PatientName; ?>">
										<input type="hidden" name="Age" value="<?php echo $Age; ?>">
										<input type="hidden" name="Sex" value="<?php echo $Sex; ?>">
										<input type="hidden" name="Status" value="R">
										<input type="hidden" name="ppge" value="<?php echo $_SERVER['REQUEST_URI']; ?>">
									
										
									
										
							
                    </div>

			</div>
			 
                <div class="col-lg-3" style="padding-top:0px;">
				
					<div class="panel panel-default">
                        
                        <div class="panel-body">
                            <div class="row" style="margin-left: 1px;">
									<div class="form-group">
										<table width="100%">
												<tr>
														
												<td  width="20%">
													<b><textarea Placeholder="Reminder" class="form-control red" style="height:55px;" name="Reminder" id="Reminder"><?php echo $Reminder; ?></textarea></b>
													
												</td>
												<td width="5%">
												</td>
												<td  width="20%">
													<b><textarea Placeholder="Note" class="form-control red" class="red" style="height:55px;" name="Note1" id="Note1"><?php echo $Note1; ?></textarea></b>
													
												</td>
												</tr>
												</table>
                                            
                                           
                                     </div>
										
                            			<div class="form-group">
                                            <textarea  Placeholder="Complaints" class="form-control Complaints"  id="Complaints" style="height:255px;" name="Complaints" ><?php echo $Complaints; ?></textarea>
											
                                         </div>
										
                            			<div class="form-group">   
										<textarea Placeholder="Findings" class="form-control Findings" style="height:155px;" name="Findings" id="findings"><?php echo $Findings; ?></textarea>
                                           
                                        
										
										
										</div>
							</div>
						</div>
					</div>
				</div>
				<div class="col-lg-4" style="padding-top:0px;">
				
					<div class="panel panel-default">
                        
                        <div class="panel-body">
               
							<div class="row" style="margin-left: 1px;">
								
								<div class="col-lg-12" >
                                  
                                        
										
										
									<div class="form-group" >
										<div class="form-group">
											<table width="100%">
												<tr>
														
												<td  width="20%">
													<button class="btn btn-primary form-control" type="submit" name="Ix" >Ix</button>
													
												</td>
												<td width="5%">
												</td>
												<td  width="20%">
													<button class="btn btn-primary form-control" href="clinical.php?view=<?php echo $row['ID'];?> type="submit" name="update" >Save</button>
													
												</td>
												<td width="10%">
												</td>
												
												<div id="dvPassport" style="display: none" class="form-group">
                                            <textarea placeholder="Certificate" class="form-control Advise"  style="height:5px;" name="Certificate" id="Certificate"><?php echo $Certificate; ?></textarea>
											<script>
												CKEDITOR.replace('Certificate') ;
												
										    </script>   
										</div>
											
										<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
										<script type="text/javascript">
											$(function () {
												$("input[name=Certificate]").click(function () {
													if ($(this).val() == "C") {
														$("#dvPassport").show();
														
														
													} else {
														$("#dvPassport").hide();
													}
												});
											});
										</script>
										<td>
										<input type="button" class="btn btn-danger form-control" href="disability.php?view=<?php echo $ID; ?>" value="C" name = "Certificate" />
										</TD>
												<td  width="25%">
													<a class="btn btn-danger" href="certificate.php?view=<?php echo $ID; ?>" class="view_btn" >Certificate</a>
													
												</td>
												<td width="5%">
												</td>
												
												<td  width="25%">
													<a class="btn btn-danger" href="disability.php?view=<?php echo $ID; ?>" class="view_btn" >Disability</a>
												</td>
													
											</tr>
											</table>
										</div>
										
											
											<table width="100%">
												<tr>
												<td width="70%">
													<?php $results = mysqli_query($conn, "SELECT * FROM source"); ?>
													<select class="form-control chzn_z span3 dropDownId chzn-done" name="Diagnosis" value="<?php echo trim($Diagnosis); ?>"  id="Diagnosis" >
														<option value="" </option>
														<?php while ($row = mysqli_fetch_array($results)) { ?>
														
														<option value="<?php echo $row['Diagnosis']; ?>" data-id="<?php echo $row['OTreatment']; ?>" ><?php echo $row['Diagnosis']; ?></option>
														<?php } ?>	
											
														
														</select>
													
													
												</td>
												
											
											
												
												</tr>
											</table>
										</div>
										
										<div class="form-group">
											<table width="100%">
												<tr>
														<td  width="20%">
														<input class="form-control criteria_rate1 span2" id="Tabs" type="text" name="Tabs" value="<?php echo $Tabs; ?>" >
														</td>
														
												<td width="40%">
													<form class="form-inline" >
													<input list="medicine_list1" class="form-control" name="medicine_title_1" id="medicine_title_id1">
													<?php $results = mysqli_query($conn, "SELECT * FROM Source where Medicines is not null order by Medicines desc"); ?>
													<datalist id="medicine_list1">
														<?php while ($row = mysqli_fetch_array($results)) { ?>
															<option value="<?php echo $row['Medicines']; ?>" data-id="<?php echo $row['Tabs']; ?>" data-id1="<?php echo $row['Dose']; ?>" data-id12="<?php echo $row['Days']; ?>" ><?php echo $row['Medicines']; ?></option>
														<?php } ?>	
													</datalist>
													<?php $results = mysqli_query($conn, "SELECT * FROM Source where Medicines is not null order by Medicines desc"); ?>
													<select class="form-control chzn_z span3 dropDownId chzn-done" name="Medicines" value="<?php echo trim($Medicines); ?>"  id="Medicines" >
													
													<?php while ($row = mysqli_fetch_array($results)) { ?>
														<option value="<?php echo $row['Medicines']; ?>" data-id="<?php echo $row['Tabs']; ?>" data-id1="<?php echo $row['Dose']; ?>" data-id2="<?php echo $row['Days']; ?>" ><?php echo $row['Medicines']; ?></option>
														
														<?php } ?>	
											
														
														</select>
														</td>
														<td>
														<input class="form-control criteria_rate2 span2" id="Dose" type="text" name="Dose" value="<?php echo $Dose; ?>" >
														</td>
														
														
														<script type="text/javascript">
															$('#Medicines').change(function(){
															var criteria_id1 =  $(':selected',this).data('id');
															var criteria_id2 =  $(':selected',this).data('id1');
															
															
															$('.criteria_rate1').val(criteria_id1);
															$('.criteria_rate2').val(criteria_id2);
															
															
															});
														</script>       
														<script type="text/javascript">
															$('#medicine_list1').change(function(){
															var criteria_id1 =  $(':selected',this).data('id');
															var criteria_id2 =  $(':selected',this).data('id1');
															
															
															$('.criteria_rate1').val(criteria_id1);
															$('.criteria_rate2').val(criteria_id2);
															
															
															});
														</script>       
										
													
													</form>
												</td>
												<td>&nbsp;&nbsp;&nbsp;
												</td>
												<td  width="10%">
													<button type="button" id="btn3" class="btn btn-danger btn-"><i class="fa fa-plus"></i></button>
												</td>
												<script>
												var input = document.getElementById("Medicines");
												input.addEventListener("keypress", function(event) {
												if (event.key === "Enter") {
													event.preventDefault();
													document.getElementById("btn3").click();
												}
												});
												</script>
												</tr>
											</table>
										</div>
											
											
										
										
										<div class="form-group">
                                           <script>
														$(document).ready(function(){
														$("#btn3").click(function(){
														var txtm = $("#Tabs").val() + ' ' + $("#Medicines").val() + '\n' + $("#Dose").val();
														var boxm = $("#OTreatment");
														boxm.val(boxm.val() +'\n'+ txtm);
														 });
														});
											</script>	
											 <textarea placeholder="Rx" class="form-control criteria_rate" id="OTreatment" style="height:220px;" name="OTreatment"><?php echo $Treatment1; ?></textarea>
                                         
										<script type="text/javascript">
											$('#Diagnosis').change(function(){
												  var criteria_fees =  $(':selected',this).data('id');
												$('.criteria_rate').val(criteria_fees);
											});
										</script>   

											
                                           
                                        </div>
										<div class="form-group">
										<?php if ($Advise!=null) { ?>
                                            <textarea placeholder="Advise" class="form-control Advise"  style="height:100px;" name="Advise" id="advice"><?php echo $Advise; ?></textarea>
                                            <?php }
											else { ?>
												<textarea placeholder="Advise" class="form-control Advise"  style="height:100px;" name="Advise" id="advice"><?php echo "Follow up after 15 days"; ?></textarea>
                                            
											<?php } ?>
											<input type="hidden" name="Status" value="P">
                                        </div>
										
										
										
										
								</div>
								
								
							</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 OPD : Entry
                        </div>
						<!-- /.panel-heading -->
						
                      
                        <div class="panel-body">
							<?php $results = mysqli_query($conn, "SELECT * FROM bdaily where RegNo='$RegNo'"); ?>
                            <table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-example">
                                <thead>
                                    <tr>
                                       
                                        <TH>DATE</TH>
										<TH>Pulse </TH>
										<TH>BP </TH>
										<TH>Weight </TH>
										<th>CASE TYPE</th>
                                        <TH>View</TH>                                       
										<TH>Copy</TH>
										
                                    </tr>
                                </thead>
								
								<tbody>
				<?php while ($row = mysqli_fetch_array($results)) { ?>
					<tr>
						
						<th class="blue"><?php echo $row['Date']; ?></th>
						<th><?php echo $row['Pulse']; ?></th>
						<td><?php echo $row['BPS']; ?>/<?php echo $row['BPD']; ?></td>
						<td><?php echo $row['Weight']; ?></td>
						<td><?php echo $row['Caseo']; ?></td>
						<td><a class="btn btn-success"  href="clinical.php?view=<?php echo $row['ID']; ?>"  >View</a></td>
						<td>
						<a class="btn btn-warning viewcomplaints" target="_top"  
						
						data-Complaints="<?php echo $row['Complaints']; ?>" 
						data-Findings="<?php echo $row['Findings']; ?>"
						data-Advise="<?php echo $row['Advise']; ?>"
						data-Treatment1="<?php echo $row['Treatment1']; ?>"
						
						>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>


    </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-example1').DataTable({
            responsive: true
        });
    });
    </script>


    <!-- /#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>
			$('#diagnoses_id2').change(function(){
				  var criteria_id =  $(':selected',this).data('id');
				$('.rx_text').val(criteria_id);
			});
			

			
			
        </script>
	
  <script>
			
			$('#txt2').change(function(){
		var ca1 = parseInt(document.getElementById("txt1").value);
        var ca2 = parseInt(document.getElementById("txt2").value);
       
		var pa1 = parseInt(document.getElementById("txt3").value);
        var pa2 = parseInt(document.getElementById("txt4").value);
       
		var xr1 = parseInt(document.getElementById("txt5").value);
        var xr2 = parseInt(document.getElementById("txt6").value);
       
		var el1 = parseInt(document.getElementById("txt7").value);
        var el2 = parseInt(document.getElementById("txt8").value);
      
		var ph1 = parseInt(document.getElementById("txt9").value);
        var ph2 = parseInt(document.getElementById("txt10").value);
      
		var ho1 = parseInt(document.getElementById("txt11").value);
        var ho2 = parseInt(document.getElementById("txt12").value);
      
		var ct1 = parseInt(document.getElementById("txt13").value);
        var ct2 = parseInt(document.getElementById("txt14").value);
       
		var tam = ca1 + pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = ca2 + pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		
		
		var t = tam - dis;
		
				
				$('.Discount').val(dis)
				$('.Total').val(t)
		var xx = pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		var tx = xx - dis;
		$('.TotalIx').val(tx)
			});
			$('#txt4').change(function(){
		var ca1 = parseInt(document.getElementById("txt1").value);
        var ca2 = parseInt(document.getElementById("txt2").value);
       
		var pa1 = parseInt(document.getElementById("txt3").value);
        var pa2 = parseInt(document.getElementById("txt4").value);
       
		var xr1 = parseInt(document.getElementById("txt5").value);
        var xr2 = parseInt(document.getElementById("txt6").value);
       
		var el1 = parseInt(document.getElementById("txt7").value);
        var el2 = parseInt(document.getElementById("txt8").value);
      
		var ph1 = parseInt(document.getElementById("txt9").value);
        var ph2 = parseInt(document.getElementById("txt10").value);
      
		var ho1 = parseInt(document.getElementById("txt11").value);
        var ho2 = parseInt(document.getElementById("txt12").value);
      
		var ct1 = parseInt(document.getElementById("txt13").value);
        var ct2 = parseInt(document.getElementById("txt14").value);
       
		var tam = ca1 + pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = ca2 + pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		
		
		var t = tam - dis;
		
				
				$('.Discount').val(dis)
				$('.Total').val(t)
		var xx = pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		var tx = xx - dis;
		$('.TotalIx').val(tx)
			});
			$('#txt6').change(function(){
		var ca1 = parseInt(document.getElementById("txt1").value);
        var ca2 = parseInt(document.getElementById("txt2").value);
       
		var pa1 = parseInt(document.getElementById("txt3").value);
        var pa2 = parseInt(document.getElementById("txt4").value);
       
		var xr1 = parseInt(document.getElementById("txt5").value);
        var xr2 = parseInt(document.getElementById("txt6").value);
       
		var el1 = parseInt(document.getElementById("txt7").value);
        var el2 = parseInt(document.getElementById("txt8").value);
      
		var ph1 = parseInt(document.getElementById("txt9").value);
        var ph2 = parseInt(document.getElementById("txt10").value);
      
		var ho1 = parseInt(document.getElementById("txt11").value);
        var ho2 = parseInt(document.getElementById("txt12").value);
      
		var ct1 = parseInt(document.getElementById("txt13").value);
        var ct2 = parseInt(document.getElementById("txt14").value);
       
		var tam = ca1 + pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = ca2 + pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		
		
		var t = tam - dis;
		
				
				$('.Discount').val(dis)
				$('.Total').val(t)
		var xx = pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		var tx = xx - dis;
		$('.TotalIx').val(tx)
			});
			$('#txt8').change(function(){
		var ca1 = parseInt(document.getElementById("txt1").value);
        var ca2 = parseInt(document.getElementById("txt2").value);
       
		var pa1 = parseInt(document.getElementById("txt3").value);
        var pa2 = parseInt(document.getElementById("txt4").value);
       
		var xr1 = parseInt(document.getElementById("txt5").value);
        var xr2 = parseInt(document.getElementById("txt6").value);
       
		var el1 = parseInt(document.getElementById("txt7").value);
        var el2 = parseInt(document.getElementById("txt8").value);
      
		var ph1 = parseInt(document.getElementById("txt9").value);
        var ph2 = parseInt(document.getElementById("txt10").value);
      
		var ho1 = parseInt(document.getElementById("txt11").value);
        var ho2 = parseInt(document.getElementById("txt12").value);
      
		var ct1 = parseInt(document.getElementById("txt13").value);
        var ct2 = parseInt(document.getElementById("txt14").value);
       
		var tam = ca1 + pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = ca2 + pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		
		
		var t = tam - dis;
		
				
				$('.Discount').val(dis)
				$('.Total').val(t)
		var xx = pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		var tx = xx - dis;
		$('.TotalIx').val(tx)
			});
			$('#txt10').change(function(){
		var ca1 = parseInt(document.getElementById("txt1").value);
        var ca2 = parseInt(document.getElementById("txt2").value);
       
		var pa1 = parseInt(document.getElementById("txt3").value);
        var pa2 = parseInt(document.getElementById("txt4").value);
       
		var xr1 = parseInt(document.getElementById("txt5").value);
        var xr2 = parseInt(document.getElementById("txt6").value);
       
		var el1 = parseInt(document.getElementById("txt7").value);
        var el2 = parseInt(document.getElementById("txt8").value);
      
		var ph1 = parseInt(document.getElementById("txt9").value);
        var ph2 = parseInt(document.getElementById("txt10").value);
      
		var ho1 = parseInt(document.getElementById("txt11").value);
        var ho2 = parseInt(document.getElementById("txt12").value);
      
		var ct1 = parseInt(document.getElementById("txt13").value);
        var ct2 = parseInt(document.getElementById("txt14").value);
       
		var tam = ca1 + pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = ca2 + pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		
		
		var t = tam - dis;
		
				
				$('.Discount').val(dis)
				$('.Total').val(t)
		var xx = pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		var tx = xx - dis;
		$('.TotalIx').val(tx)
			});
			$('#txt12').change(function(){
		var ca1 = parseInt(document.getElementById("txt1").value);
        var ca2 = parseInt(document.getElementById("txt2").value);
       
		var pa1 = parseInt(document.getElementById("txt3").value);
        var pa2 = parseInt(document.getElementById("txt4").value);
       
		var xr1 = parseInt(document.getElementById("txt5").value);
        var xr2 = parseInt(document.getElementById("txt6").value);
       
		var el1 = parseInt(document.getElementById("txt7").value);
        var el2 = parseInt(document.getElementById("txt8").value);
      
		var ph1 = parseInt(document.getElementById("txt9").value);
        var ph2 = parseInt(document.getElementById("txt10").value);
      
		var ho1 = parseInt(document.getElementById("txt11").value);
        var ho2 = parseInt(document.getElementById("txt12").value);
      
		var ct1 = parseInt(document.getElementById("txt13").value);
        var ct2 = parseInt(document.getElementById("txt14").value);
       
		var tam = ca1 + pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = ca2 + pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		
		
		var t = tam - dis;
		
				
				$('.Discount').val(dis)
				$('.Total').val(t)
		var xx = pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		var tx = xx - dis;
		$('.TotalIx').val(tx)
			});
			
			$('#txt14').change(function(){
		var ca1 = parseInt(document.getElementById("txt1").value);
        var ca2 = parseInt(document.getElementById("txt2").value);
       
		var pa1 = parseInt(document.getElementById("txt3").value);
        var pa2 = parseInt(document.getElementById("txt4").value);
       
		var xr1 = parseInt(document.getElementById("txt5").value);
        var xr2 = parseInt(document.getElementById("txt6").value);
       
		var el1 = parseInt(document.getElementById("txt7").value);
        var el2 = parseInt(document.getElementById("txt8").value);
      
		var ph1 = parseInt(document.getElementById("txt9").value);
        var ph2 = parseInt(document.getElementById("txt10").value);
      
		var ho1 = parseInt(document.getElementById("txt11").value);
        var ho2 = parseInt(document.getElementById("txt12").value);
      
		var ct1 = parseInt(document.getElementById("txt13").value);
        var ct2 = parseInt(document.getElementById("txt14").value);
       
		var tam = ca1 + pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = ca2 + pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		
		
		var t = tam - dis;
		
				
				$('.Discount').val(dis)
				$('.Total').val(t)
		var xx = pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		var tx = xx - dis;
		$('.TotalIx').val(tx)
			});
			
			$('#Case').change(function(){
				var Case_id =  $(':selected',this).data('id');
				$('.CAmount').val(Case_id);
				
			});
			
			$('#Pathology').change(function(){
				  var Pathology_id =  $(':selected',this).data('id');
				$('.PAmount').val(Pathology_id);
				var ca1 = parseInt(document.getElementById("txt1").value);
        var ca2 = parseInt(document.getElementById("txt2").value);
       
		var pa1 = parseInt(document.getElementById("txt3").value);
        var pa2 = parseInt(document.getElementById("txt4").value);
       
		var xr1 = parseInt(document.getElementById("txt5").value);
        var xr2 = parseInt(document.getElementById("txt6").value);
       
		var el1 = parseInt(document.getElementById("txt7").value);
        var el2 = parseInt(document.getElementById("txt8").value);
      
		var ph1 = parseInt(document.getElementById("txt9").value);
        var ph2 = parseInt(document.getElementById("txt10").value);
      
		var ho1 = parseInt(document.getElementById("txt11").value);
        var ho2 = parseInt(document.getElementById("txt12").value);
      
		var ct1 = parseInt(document.getElementById("txt13").value);
        var ct2 = parseInt(document.getElementById("txt14").value);
       
		var tam = ca1 + pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = ca2 + pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		
		
		var t = tam - dis;
		
				
				$('.Discount').val(dis)
				$('.Total').val(t)
		var xx = pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		var tx = xx - dis;
		$('.TotalIx').val(tx)
		
			});
			
			$('#Xray').change(function(){
				  var Xray_id =  $(':selected',this).data('id');
				$('.XAmount').val(Xray_id);
		var ca1 = parseInt(document.getElementById("txt1").value);
        var ca2 = parseInt(document.getElementById("txt2").value);
       
		var pa1 = parseInt(document.getElementById("txt3").value);
        var pa2 = parseInt(document.getElementById("txt4").value);
       
		var xr1 = parseInt(document.getElementById("txt5").value);
        var xr2 = parseInt(document.getElementById("txt6").value);
       
		var el1 = parseInt(document.getElementById("txt7").value);
        var el2 = parseInt(document.getElementById("txt8").value);
      
		var ph1 = parseInt(document.getElementById("txt9").value);
        var ph2 = parseInt(document.getElementById("txt10").value);
      
		var ho1 = parseInt(document.getElementById("txt11").value);
        var ho2 = parseInt(document.getElementById("txt12").value);
      
		var ct1 = parseInt(document.getElementById("txt13").value);
        var ct2 = parseInt(document.getElementById("txt14").value);
       
		var tam = ca1 + pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = ca2 + pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		
		
		var t = tam - dis;
		
				
				$('.Discount').val(dis)
				$('.Total').val(t)
		var xx = pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		var tx = xx - dis;
		$('.TotalIx').val(tx)
		
			});
			
			$('#Electrodiagnostics').change(function(){
				  var Electrodiagnostics_id =  $(':selected',this).data('id');
				$('.EAmount').val(Electrodiagnostics_id);
				var ca1 = parseInt(document.getElementById("txt1").value);
        var ca2 = parseInt(document.getElementById("txt2").value);
       
		var pa1 = parseInt(document.getElementById("txt3").value);
        var pa2 = parseInt(document.getElementById("txt4").value);
       
		var xr1 = parseInt(document.getElementById("txt5").value);
        var xr2 = parseInt(document.getElementById("txt6").value);
       
		var el1 = parseInt(document.getElementById("txt7").value);
        var el2 = parseInt(document.getElementById("txt8").value);
      
		var ph1 = parseInt(document.getElementById("txt9").value);
        var ph2 = parseInt(document.getElementById("txt10").value);
      
		var ho1 = parseInt(document.getElementById("txt11").value);
        var ho2 = parseInt(document.getElementById("txt12").value);
      
		var ct1 = parseInt(document.getElementById("txt13").value);
        var ct2 = parseInt(document.getElementById("txt14").value);
       
		var tam = ca1 + pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = ca2 + pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		
		
		var t = tam - dis;
		
				
				$('.Discount').val(dis)
				$('.Total').val(t)
		var xx = pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		var tx = xx - dis;
		$('.TotalIx').val(tx)
		
			});
			
			$('#Physiotherapy').change(function(){
				  var Physiotherapy_id =  $(':selected',this).data('id');
				$('.PhyAmount').val(Physiotherapy_id);
				var ca1 = parseInt(document.getElementById("txt1").value);
        var ca2 = parseInt(document.getElementById("txt2").value);
       
		var pa1 = parseInt(document.getElementById("txt3").value);
        var pa2 = parseInt(document.getElementById("txt4").value);
       
		var xr1 = parseInt(document.getElementById("txt5").value);
        var xr2 = parseInt(document.getElementById("txt6").value);
       
		var el1 = parseInt(document.getElementById("txt7").value);
        var el2 = parseInt(document.getElementById("txt8").value);
      
		var ph1 = parseInt(document.getElementById("txt9").value);
        var ph2 = parseInt(document.getElementById("txt10").value);
      
		var ho1 = parseInt(document.getElementById("txt11").value);
        var ho2 = parseInt(document.getElementById("txt12").value);
      
		var ct1 = parseInt(document.getElementById("txt13").value);
        var ct2 = parseInt(document.getElementById("txt14").value);
       
		var tam = ca1 + pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = ca2 + pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		
		
		var t = tam - dis;
		
				
				$('.Discount').val(dis)
				$('.Total').val(t)
		var xx = pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		var tx = xx - dis;
		$('.TotalIx').val(tx)
		
			});
			
			$('#Treatment').change(function(){
				  var Treatment_id =  $(':selected',this).data('id');
				$('.TAmount').val(Treatment_id);
				var ca1 = parseInt(document.getElementById("txt1").value);
        var ca2 = parseInt(document.getElementById("txt2").value);
       
		var pa1 = parseInt(document.getElementById("txt3").value);
        var pa2 = parseInt(document.getElementById("txt4").value);
       
		var xr1 = parseInt(document.getElementById("txt5").value);
        var xr2 = parseInt(document.getElementById("txt6").value);
       
		var el1 = parseInt(document.getElementById("txt7").value);
        var el2 = parseInt(document.getElementById("txt8").value);
      
		var ph1 = parseInt(document.getElementById("txt9").value);
        var ph2 = parseInt(document.getElementById("txt10").value);
      
		var ho1 = parseInt(document.getElementById("txt11").value);
        var ho2 = parseInt(document.getElementById("txt12").value);
      
		var ct1 = parseInt(document.getElementById("txt13").value);
        var ct2 = parseInt(document.getElementById("txt14").value);
       
		var tam = ca1 + pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = ca2 + pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		
		
		var t = tam - dis;
		
				
				$('.Discount').val(dis)
				$('.Total').val(t)
		var xx = pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		var tx = xx - dis;
		$('.TotalIx').val(tx)
		
			});
			
			$('#CTscan').change(function(){
				  var CTscan_id =  $(':selected',this).data('id');
				$('.CTAmount').val(CTscan_id);
				var ca1 = parseInt(document.getElementById("txt1").value);
        var ca2 = parseInt(document.getElementById("txt2").value);
       
		var pa1 = parseInt(document.getElementById("txt3").value);
        var pa2 = parseInt(document.getElementById("txt4").value);
       
		var xr1 = parseInt(document.getElementById("txt5").value);
        var xr2 = parseInt(document.getElementById("txt6").value);
       
		var el1 = parseInt(document.getElementById("txt7").value);
        var el2 = parseInt(document.getElementById("txt8").value);
      
		var ph1 = parseInt(document.getElementById("txt9").value);
        var ph2 = parseInt(document.getElementById("txt10").value);
      
		var ho1 = parseInt(document.getElementById("txt11").value);
        var ho2 = parseInt(document.getElementById("txt12").value);
      
		var ct1 = parseInt(document.getElementById("txt13").value);
        var ct2 = parseInt(document.getElementById("txt14").value);
       
		var tam = ca1 + pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = ca2 + pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		
		
		var t = tam - dis;
		
				
				$('.Discount').val(dis)
				$('.Total').val(t)
		var xx = pa1 + xr1 + el1 + ph1 + ho1 + ct1;
		
		var dis = pa2 + xr2 + el2 + ph2 + ho2 + ct2;
		
		var tx = xx - dis;
		$('.TotalIx').val(tx)
		
			});
			
			
        </script>
	 
 <script>
	 $(document).ready(function()
{
    $(window).bind("beforeunload", function() { 
            var elemid = $('.autobutton').attr('id');
            var elem = document.getElementById(elemid);             
            if (typeof elem.onclick == 'function')
            {                 
                elem.onclick.apply(elem);
            }
         
        //return confirm("Do you really want to close?"); 
    });
});
</script>
	 


</body>

</html>

User avatar
Michalio
Moderator
Moderator
Posts: 265
Joined: Sun Jul 18, 2021 1:33 pm
Location: Poland

to be honest the code looks bad, you should clean the code first, it will be a good exercise learning php/html.
For example why you include jquery twice? There is many other things like that and it make any changes more difficult to implement
Free coding lessons: https://php-forum.com/phpforum/viewtopic.php?t=29852
Dharmeshdhabu
New php-forum User
New php-forum User
Posts: 21
Joined: Sat Jul 23, 2022 6:45 pm

Michalio wrote: Wed Sep 21, 2022 7:04 am to be honest the code looks bad, you should clean the code first, it will be a good exercise learning php/html.
For example why you include jquery twice? There is many other things like that and it make any changes more difficult to implement
I understand that my page is not systematic. Actually I am not a software engineer but a doctor. Someone left project incomplete and I myself am trying to give it proper shape. So I request you to ignore my unprofessionalism and guide me in my aim of copy and paste data in textarea as needed. I will be thankful to you.
User avatar
Michalio
Moderator
Moderator
Posts: 265
Joined: Sun Jul 18, 2021 1:33 pm
Location: Poland

You should hire someone, especially if you want to store personal data or real users in this app
Free coding lessons: https://php-forum.com/phpforum/viewtopic.php?t=29852
Dharmeshdhabu
New php-forum User
New php-forum User
Posts: 21
Joined: Sat Jul 23, 2022 6:45 pm

Michalio wrote: Fri Sep 23, 2022 6:22 am You should hire someone, especially if you want to store personal data or real users in this app
Actually I purchased software from VIPL company but they did not comply. So during lockdown I created VB6 based application. It was functioning nice. Still I was willing to upgrade so I took help of someone who created project to certain extent and left. So I rebuild my project and at present I am using it regularly since about 6 months. I have certain functions which needs attention. No one is ready to get involved in project which is running. That is my problem. So I am asking for help if you can. Thanks
User avatar
Michalio
Moderator
Moderator
Posts: 265
Joined: Sun Jul 18, 2021 1:33 pm
Location: Poland

You have basic knowledge about programming in php and javascript. There is a large gap between your skills and skills needed to finish your app. It is like I fill pain in my chest and decide to do the surgery on myself and ask you to guide me hoe to do that.
At first you need to know how work forms on your page (how it is send to the server and how to read it on backed to save in the database), then you need to know how to manipulate the DOM in javascript (get element by id or class and get/set some value), then you will be able to finish that you wanted to do.
Some useful links:
https://www.w3schools.com/php/php_forms.asp
https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById
https://www.w3schools.com/jquery/jquery_selectors.asp
Free coding lessons: https://php-forum.com/phpforum/viewtopic.php?t=29852
Post Reply