<?php
require'header.php';
require'includes/head2.php';

$current=date('Y-m-d');
require'../connections/conn.php';
$cond="`appointment`.`p_id`=`patient`.`p_id` and `date`<'$current' and `status`=1 ";
if((isset($_POST['p_name']))&&($_POST['p_name']!=""))
{
$p_name=$_POST['p_name'];
$cond.="and `p_name`like'$p_name%'";
}
$p="select * from `appointment`,`patient` where $cond  order by `date`";
$r=$conn->query($p);
echo"<table border=4 width='1100px' style='font-size:16pt'  >
		
		<tr>
			<th>Name</th><th>Mobile</th>
			<th>Birth</th><th>Date</th><th colspan=2></th>
		</tr>
		<tr><form action='' method='post'>
			<td style='text-align:center'><input type='text' name='p_name' placeholder='Search By Name'></td><td style='text-align:center'><input class='button-6' type='submit' name='submit' value='Search'></td><td colspan=4></td>
		</form></tr>";
while($row=mysqli_fetch_array($r))
{
	echo"<tr>
			<td>".$row['p_name']."</td><td>".$row['p_mobile']."</td><td style='text-align:center'>".$row['p_age']."</td>
			<td>".$row['date']."</td>
			<td style='text-align:center'><a class='button-6' href='detail.php?app_id=".$row['app_id']."&&p_id=".$row['p_id']."'>Detail</a></td>
			<td style='text-align:center'><a class='button-6' href='finish.php?app_id=".$row['app_id']."'>Finish</a></td>";
		echo"</tr>";
}
echo"</table>";
require 'includes/foot.php';?>

