<?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>
<?php

$old="select * from `appointment` where `p_id`=$p  order by `date`";
$rold=$conn->query($old);
while($row2=mysqli_fetch_array($rold))	
{
	$app2=$row2['app_id'];
	$test=$row2['test'];
	?>
<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">
				SX/SI:
			</td>
			<td bgcolor="lightgrey">
				<textarea name="sxsi" cols='25' rows='8' style="font-size:18"><?php echo $row2['sx/si'];?></textarea>
			</td>
			<td bgcolor="lightgrey">
				BP:<input size="4" type="text" value="bp"><br>
				BP:<input size="4" type="text" value="bp"><hr>
				BP:<input size="4" type="text" value="bp"><br>
				BP:<input size="4" type="text" value="bp">
			</td>
			
			<td bgcolor="lightgreen">
				Test:
			</td>
			<td bgcolor="lightgreen">
				<textarea name="test" cols='25' rows='8' style="font-size:18"><?php echo $row2['test'];?></textarea>
			</td>
		
			<td bgcolor="lightblue">
				Treatment:
			</td>
			<td bgcolor="lightblue">
				<textarea name="treatment" cols='25' rows='8' style="font-size:18"><?php echo $row2['treatment'];?></textarea>
			</td>
	
			<td bgcolor="lightyellow">
				Note:
			</td>
			<td bgcolor="lightyellow">
				<textarea name="note" cols='25' rows='8' style="font-size:18"><?php echo $row2['note'];?></textarea>
			</td>
			<td>
				<?php echo $row2['date'];?>
				
				<a style="background-color:blue;color:White;text-decoration:none; padding:3px; text-align:right"
				href="date_edit.php?app=<?php echo $app;?>&&p=<?php echo $p;?>&&app_id=<?php echo $row2['app_id'];?>">EditDate</a>
			
		</tr>
	</form>
<?php }?>
</table><br>

			<a href="home.php" style="background-color:black;color:White;text-decoration:none; padding:3px">Back</a>
