-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewPHP.php
101 lines (87 loc) · 3.76 KB
/
viewPHP.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
if (isset($_POST['back'])) {
header("Location: main.php");
exit;
}
include('connectFN.php');
$con = mysqli_connect("localhost", "root", "", "exam");
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>View Records</title>
<link rel="stylesheet" href="css/design.css" />
<script src="jquery-3.5.0.min.js"></script>
<script>
$(document).ready(function() {
$("#myInput").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#myTable tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
</script>
</head>
<body>
<div class="con" style="padding-bottom: 400px">
<div class="form">
<p><a href="main.php">Home</a> | <a href="index.php" style="color: red">Logout </a>| <a href="viewHTML.html">Back</a></p>
<h3 style="float: left; margin-left: 30%">Search Records</h3>
<input id="myInput" type="text" placeholder="Search.." style="margin-left: -20% ; margin-top: 21px" />
<table width="100%" border="1" style="border-collapse:collapse; ">
<thead>
<tr>
<th><strong>
<h3>S.No</h3>
</strong></th>
<th><strong>
<h3> Banking</h3>
</strong></th>
<th><strong>
<h3>Scarlet</h3>
</strong></th>
<th><strong>
<h3>Bouncer</h3>
</strong></th>
</tr>
</thead>
<tbody>
<?php
$count = 1;
$Scarlet = $_POST['x'];
$Banking = $_POST['y'];
$Bouncer = $_POST['z'];
if (empty($Scarlet) && empty($Banking) && empty($Bouncer)) {
$sel_query = "Select * from data";
} else if (!empty($Scarlet) && empty($Banking) && empty($Bouncer)) {
$sel_query = "Select * from data Where Scarlet = '$Scarlet '";
} else if (empty($Scarlet) && !empty($Banking) && empty($Bouncer)) {
$sel_query = "Select * from data Where Banking = '$Banking'";
} else if (empty($Scarlet) && empty($Banking) && !empty($Bouncer)) {
$sel_query = "Select * from data Where Bouncer = '$Bouncer'";
} else if (empty($Scarlet) && !empty($Banking) && !empty($Bouncer)) {
$sel_query = "Select * from data Where Banking = '$Banking' AND Bouncer = '$Bouncer'";
} else {
die("Please follow search rules<br>$back");
}
$result = mysqli_query($con, $sel_query);
while ($row = mysqli_fetch_assoc($result)) { ?>
<tbody id="myTable">
<tr>
<td align="center"><?php echo $count; ?></td>
<td align="center"><?php echo $row["Banking"]; ?></td>
<td align="center"><?php echo $row["Scarlet"]; ?></td>
<td align="center"><?php echo $row["Bouncer"]; ?></td>
</tr>
</tbody>
<?php
$count++; }
?>
</tbody>
</table>
</div>
</div>
</body>
</html>