<link rel="stylesheet" type="text/css" href="search/jquery.autocomplete.css" />
<script type="text/javascript" src="search/jquery.js"></script>
<script type="text/javascript" src="search/jquery.autocomplete.js"></script>
<script>
$(document).ready(function(){
 $("#tag").autocomplete("search/autocomplete_treat.php", {
		selectFirst: true
	});
});
</script>
<style>
	.a2{
		margin-left:5px;
		color:black;
		text-decoration:none;
		background-color:#f9f9f9;
		padding:2px;
	}
	.a1{
		margin-left:5px;
		color:#f9f9f9;
		text-decoration:none;
		background-color:black;
		padding:2px;
	}
	.a1:hover{background-color:red;padding:3px}
	.a2:hover{background-color:red;padding:3px}



	.button-30 {
  align-items: center;
  appearance: none;
  background-color: #FCFCFD;
  border-radius: 4px;
  border-width: 0;
  box-shadow: rgba(45, 35, 66, 0.4) 0 2px 4px,rgba(45, 35, 66, 0.3) 0 7px 13px -3px,#D6D6E7 0 -3px 0 inset;
  box-sizing: border-box;
  color: #36395A;
  cursor: pointer;
  display: inline-flex;
  font-family: "JetBrains Mono",monospace;
  height: 48px;
  justify-content: center;
  line-height: 1;
  list-style: none;
  overflow: hidden;
  padding-left: 16px;
  padding-right: 16px;
  position: relative;
  text-align: left;
  text-decoration: none;
  transition: box-shadow .15s,transform .15s;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  white-space: nowrap;
  will-change: box-shadow,transform;
  font-size: 18px;
}

.button-30:focus {
  box-shadow: #D6D6E7 0 0 0 1.5px inset, rgba(45, 35, 66, 0.4) 0 2px 4px, rgba(45, 35, 66, 0.3) 0 7px 13px -3px, #D6D6E7 0 -3px 0 inset;
}

.button-30:hover {
  box-shadow: rgba(45, 35, 66, 0.4) 0 4px 8px, rgba(45, 35, 66, 0.3) 0 7px 13px -3px, #D6D6E7 0 -3px 0 inset;
  transform: translateY(-2px);
}

.button-30:active {
  box-shadow: #D6D6E7 0 3px 7px inset;
  transform: translateY(2px);
}


</style>
<a href="home.php" style="background-color:white;color:White;text-decoration:none; padding:3px"><img width="50" height="" src="../images/blackBack.png"></a>
<?php
require'../connections/conn.php';
if(isset($_POST['submit']))
{
	$app=$_POST['app'];
	$test=$_POST['test'];
	$sxsi=$_POST['sxsi'];
	$treatment=$_POST['treatment'];
	$note=$_POST['note'];
	$set="UPDATE `appointment` SET `sx/si`='$sxsi',`test`='$test',`treatment`='$treatment',`note`='$note' WHERE  `app_id`=$app";
	$s=$conn->query($set);
	
	echo "<script type='text/javascript'>window.location.href = 'home.php'</script>";
	
}
$app=$_GET['app_id'];
$p=$_GET['p_id'];

?>
<table width=1900px>

<tr><td colspan=4></td><td colspan=2>
<form action="add_treat.php" method="get">
				<input type="hidden" name="app" value="<?php echo $app;?>">
				<input type="hidden" name="app_main" value="<?php echo $app;?>">
				<input type="hidden" name="p" value="<?php echo $p;?>">
				<input type="hidden" name="treat" value="<?php echo $p;?>">
				<input id="tag"  type="text" name="new_treat" required style="width:20em; font-size:14pt"><br><br>
				<input type="submit" name="add" value="ADD">
				</form></td></tr>
<?php

$old="select * from `appointment` where `p_id`=$p  order by `date` desc";
$rold=$conn->query($old);
while($row2=mysqli_fetch_array($rold))	
{
	$app2=$row2['app_id'];
	$test=$row2['test'];
	$treat=$row2['treatment'];
	?>

<tr>
			<td bgcolor="lightgrey" >
				SX/SI:
			</td>
		
			<th bgcolor="darkseagreen"  colspan="3" >
				Test:
			</th>

			<th bgcolor="lightblue" colspan=2>
				Treatment:
			</th>
			<td bgcolor="lightyellow">
				Note:
			</td>
			<td> </td>
				
</tr>

<form action="submit_old.php" method="post">
<input type="hidden" value="<?php echo $app;?>" name="app_main">
<input type="hidden" value="<?php echo $row2['app_id'];?>" name="app">
<input type="hidden" value="<?php echo $p;?>" name="p">
		
	<tr>		
			<td bgcolor="lightgrey">
				<textarea name="sxsi" cols='25' rows='10' style="font-size:18"><?php echo $row2['sx/si'];?></textarea>
			</td>
			<td bgcolor="darkseagreen" >
				BP:<br><input size="3" type="text" name="bp" value="<?php echo $row2['bp'];?>"><br>
				PR:<br><input size="3" type="text" name="pr" value="<?php echo $row2['pr'];?>"><br>
				Temp:<br><input size="3" type="text" name="temp" value="<?php echo $row2['temp'];?>"><br>
				Wt:<br><input size="3" type="text" name="wt" value="<?php echo $row2['wt'];?>"><br>
				
				Ht:<br><input size="3" type="text" name="ht" value="<?php echo $row2['ht'];?>">
			</td>

			<td bgcolor="darkseagreen" >
				<a class="a1"href="add_test.php?new_test=CBC&&app_main=<?php echo $app;?>&&p=<?php echo $p;?>&&app=<?php echo $app2;?>&&test='<?php echo $test;?>'">CBC</a>
				<a class="a2"href="add_test.php?new_test=Ferritin&&app_main=<?php echo $app;?>&&p=<?php echo $p;?>&&app=<?php echo $app2;?>&&test='<?php echo $test;?>'">Ferritin</a>
				<a class="a1"href="add_test.php?new_test=Vit D&&app_main=<?php echo $app;?>&&p=<?php echo $p;?>&&app=<?php echo $app2;?>&&test='<?php echo $test;?>'">Vit D</a><br><br>
				<a class="a2"href="add_test.php?new_test=Zinc&&app_main=<?php echo $app;?>&&p=<?php echo $p;?>&&app=<?php echo $app2;?>&&test='<?php echo $test;?>'">Zinc</a>
				<a class="a1"href="add_test.php?new_test=LH&&app_main=<?php echo $app;?>&&p=<?php echo $p;?>&&app=<?php echo $app2;?>&&test='<?php echo $test;?>'">LH</a>
				<a class="a2"href="add_test.php?new_test=FSH&&app_main=<?php echo $app;?>&&p=<?php echo $p;?>&&app=<?php echo $app2;?>&&test='<?php echo $test;?>'">FSH</a><br><br>
				<a class="a1"href="add_test.php?new_test=Prolactin&&app_main=<?php echo $app;?>&&p=<?php echo $p;?>&&app=<?php echo $app2;?>&&test='<?php echo $test;?>'">Prolactin</a>
				<a class="a2"href="add_test.php?new_test=Testosteron&&app_main=<?php echo $app;?>&&p=<?php echo $p;?>&&app=<?php echo $app2;?>&&test='<?php echo $test;?>'">Testosteron</a>
				<a class="a1"href="add_test.php?new_test=GUE Profile&&app_main=<?php echo $app;?>&&p=<?php echo $p;?>&&app=<?php echo $app2;?>&&test='<?php echo $test;?>'">GUE</a>
				
			</td>

			<td bgcolor="darkseagreen">
				<textarea name="test" cols='25' rows='10'style="font-size:18"><?php echo $row2['test'];?></textarea>
			</td>
			<td bgcolor="lightblue" >
				
				<a class="a1" href="add_treat.php?new_treat=Clotrimazole Cream&&app_main=<?php echo $app;?>&&p=<?php echo $p;?>&&app=<?php echo $app2;?>&&treat='<?php echo $treat;?>'">Clotrimazole</a>				
				<a class="a2"href="add_treat.php?new_treat=Fluconazole Tab 150mg&&app_main=<?php echo $app;?>&&p=<?php echo $p;?>&&app=<?php echo $app2;?>&&treat='<?php echo $treat;?>'">Fluconazole</a><br><br>
				<a class="a1"href="add_treat.php?new_treat=ketoconazole Shampoo&&app_main=<?php echo $app;?>&&p=<?php echo $p;?>&&app=<?php echo $app2;?>&&treat='<?php echo $treat;?>'">Ketoconazole Shampoo</a><br><br>
				<a class="a2"href="add_treat.php?new_treat=Fucidine Cream&&app_main=<?php echo $app;?>&&p=<?php echo $p;?>&&app=<?php echo $app2;?>&&treat='<?php echo $treat;?>'">Fucidine</a>
				<a class="a1"href="add_treat.php?new_treat=Fucidine H Cream&&app_main=<?php echo $app;?>&&p=<?php echo $p;?>&&app=<?php echo $app2;?>&&treat='<?php echo $treat;?>'">FucidineH</a><br><br>
				<a class="a2"href="add_treat.php?new_treat=Betamethason Cream&&app_main=<?php echo $app;?>&&p=<?php echo $p;?>&&app=<?php echo $app2;?>&&treat='<?php echo $treat;?>'">Beta Cream</a>
				<a class="a1"href="add_treat.php?new_treat=Isotretinoin tab 20mg&&app_main=<?php echo $app;?>&&p=<?php echo $p;?>&&app=<?php echo $app2;?>&&treat='<?php echo $treat;?>'">Isotr20</a>
				<a class="a2"href="add_treat.php?new_treat=Lip Balm&&app_main=<?php echo $app;?>&&p=<?php echo $p;?>&&app=<?php echo $app2;?>&&treat='<?php echo $treat;?>'">LipBalm</a><br><br>
				<a class="a1"href="add_treat.php?new_treat=Clindamycine Gel&&app_main=<?php echo $app;?>&&p=<?php echo $p;?>&&app=<?php echo $app2;?>&&treat='<?php echo $treat;?>'">Clind Gel</a>
				<a class="a2"href="add_treat.php?new_treat=Clindamycine Lotion&&app_main=<?php echo $app;?>&&p=<?php echo $p;?>&&app=<?php echo $app2;?>&&treat='<?php echo $treat;?>'">Clind Lotion</a>
			
		
			</td>
			<td bgcolor="lightblue">
				<textarea name="treatment"cols='35' rows='10'style="font-size:18"><?php echo $row2['treatment'];?></textarea>
			</td>
			<td bgcolor="lightyellow">
				<textarea name="note" cols='25' rows='10' style="font-size:18"><?php echo $row2['note'];?></textarea>
			</td>
			<td >
			<p><?php echo $row2['date'];?> <a href="date_edit.php?app=<?php echo $app;?>&&p=<?php echo $p;?>&&app_id=<?php echo $row2['app_id'];?>"><img width="30" height="" src="../images/calander.jpg"></a>
</p>
				
				
				<br><br><input class="button-30" type="submit" name="submitold">
			</td>
			</tr>	
<tr>
			
</tr>		
		
			
			
		
			
	
			
		
			<td>

			
		</tr>
	</form>
<?php }?>
</table><br>


