/
view_details.php
62 lines (57 loc) · 1.37 KB
/
view_details.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
if(isset($_POST['search']))
{
$valuetosearch=$_POST['id input'];
$query="select *from patient where p_id='$valuetosearch'";
$search_result = filtertable($query);
}
else
{
$query="select *from 'patient' where p_id='id input'";
$search_result=filtertable($query);
}
function filtertable($query)
{
$connect=mysqli_connect("localhost","root","","healthcare");
$filter_Result=mysqli_query($connect,$query);
return $filter_Result;
}
?>
<!Doctype html>
<head>
<title>
view details
</title>
<style>
table,tr,td,th
{
border:1px solid black;
}
</style>
</head>
<body>
<form>
patient id<input type="text" name="id input" placeholder="search id" value="search"/>
<input type="submit" name="search" value="go"><br><br>
<table>
<tr>
<th>Id</th>
<th>Name</th>
<th>Email</th>
<th>Phone</th>
<th>gender</th>
</tr>
<?php
while($row =mysqli_fetch_array($search_result)){ ?>
<tr>
<td><?php echo $row['p_id'];?></td>
<td><?php echo $row['p_name'];?></td>
<td><?php echo $row['p_email'];?></td>
<td><?php echo $row['p_phone'];?></td>
<td><?php echo $row['p_gender'];?></td>
</tr>
<?php }?>
</table>
</form>
</body>
</html>