<?php require'includes/head2.php';
if(isset($_POST['submit']))
{
	$id=$_POST['id'];
	$a=$_POST['a'];
	$n=$_POST['n'];
	$m=$_POST['m'];
	$p=$_POST['p'];
	if($a=="") $a=0;
	 $p="update `patient` set `p_name`='$n',`p_age`='$a',`p_mobile`='$m',`place`='$p'  where `p_id`='$id'";
	$r=$conn->query($p);
	header('location:patient_list.php');
	
}
$id=$_GET['p_id'];
$p="select * from `patient` where `p_id`='$id'";
$r=$conn->query($p);
while($row=mysqli_fetch_array($r))
{
?>
<table>
<form action="" method="POST">
<input type="hidden" name="id" value="<?php echo $row['p_id'];?>"><br>
<tr>
	<td><h3>Name</h3></td><td><input style="font-size:20pt;width:12em; background-color:#ffffff; border-style:none" type="text" name="n" value="<?php echo $row['p_name'];?>"></td>
</tr>
<tr>
	<td><h3>Age</h3></td><td><input style="font-size:20pt;width:12em; background-color:#ffffff; border-style:none" type="date" name="a" value="<?php echo $row['p_age'];?>"></td>
</tr>
<tr>
	<td><h3>Mobile</h3></td><td><input style="font-size:20pt;width:12em; background-color:#ffffff; border-style:none" type="text" name="m" value="<?php echo $row['p_mobile'];?>"></td>
</tr>
<tr>
	<td><h3>Address</h3></td><td><input style="font-size:20pt;width:12em; background-color:#ffffff; border-style:none" type="text" name="p" value="<?php echo $row['place'];?>"></td>
</tr>
<tr>
	<td ></td><td style="text-align:center"><input type="submit" name="submit" style="font-size:20pt;width:12em; background-color:#000000; color:#ffffff; border-style:none"></td>
</form></table>
<?php } 
require'includes/foot.php';?>
