<?php require'includes/head2.php';
	  require'header.php';
?>
<div class="form" id="form" align="left" style="margin-top:20px;">
<?php
if((isset($_POST['p_name']))&&($_POST['p_name']!=""))
{
	$name=$_POST['p_name'];
	$p="select * from `patient` where `p_name`='$name' order by `p_id`";
}
else
{
$p="select * from `patient` order by `p_id`";
}
$r=$conn->query($p);
echo "<table border='4' width='900px'>
<tr>
    <th>Name</th><th>Mobile</th><th width='70'>Age</th><th>Place</th>
    <th colspan='2'>
        <a href='patient_new.php'>
            <img src='../images/13.png' width='40'>
        </a>
    </th>
</tr>

<form method='POST'>
<tr>
    <td align='center'>
        <input type='text' name='p_name' placeholder='Search By Name' id='tag'>
    </td>
    <td align='center'>
        <input class='button-6' type='submit' name='search' value='Search'>
    </td>
    <td colspan='4'></td>
</tr>
</form>";

while ($row = mysqli_fetch_array($r)) {
    echo "
    <tr>
        <td>{$row['p_name']}</td>
        <td>{$row['p_mobile']}</td>
        <td align='center'>{$row['p_age']}</td>
        <td>{$row['place']}</td>
        <td align='center'><a href='patient_del.php?p_id={$row['p_id']}'><img src='../images/9.png' width='40'></a></td>
        <td align='center'>
            <a href='patient_edit.php?p_id={$row['p_id']}'>
                <img src='../images/edit.png' width='40'>
            </a>
        </td>
    </tr>";
}
echo "</table>";

require 'includes/foot.php';?>


