-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdropdown.php
More file actions
60 lines (46 loc) · 1.41 KB
/
dropdown.php
File metadata and controls
60 lines (46 loc) · 1.41 KB
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
<?php include('head.php'); ?>
<?php
include('ai.php');
?>
<?php
if (isset($_POST['department']) && !empty($_POST['department'])) {
$department = mysqli_real_escape_string($connection, $_POST['department']);
$query = "SELECT * FROM employee WHERE Department = '$department'";
$result = mysqli_query($connection, $query);
if (!$result) {
die("QUERY FAILED... " . mysqli_error($connection));
}
} else {
$query = "SELECT * FROM employee";
$result = mysqli_query($connection, $query);
if (!$result) {
die("QUERY FAILED... " . mysqli_error($connection));
}
}
?>
<a href="name.php" class="btn btn-secondary mt-2" style="background-color: blue">Back</a>
<table class="table table-hover table-bordered table-striped">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Department</th>
<th>Salary</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($result)) {
?>
<tr>
<td><?php echo htmlspecialchars($row['Id']); ?></td>
<td><?php echo htmlspecialchars($row['Name']); ?></td>
<td><?php echo htmlspecialchars($row['Department']); ?></td>
<td><?php echo htmlspecialchars($row['Salary']); ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php include('foot.php'); ?>