-
Notifications
You must be signed in to change notification settings - Fork 0
/
print.php
45 lines (41 loc) · 1.03 KB
/
print.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
<style>
table{
width: 100%;
height: 80%;
border-color: black;
}
th{
font-size: large;
border-color: black;
}
#d{
position: absolute;
bottom: 10px;
background-color: green;
color: white;
}
#back{
position: absolute;
bottom: 60px;
background-color: red;
color: white;
}
</style>
<?php
include "config.php";
$sql="select * from employees";
$result=mysqli_query($conn,$sql);
echo "<table ><tr style='background-color:brown;color:white'><th>EMP-ID</th><th>Employee Name</th><th>Department</th><th>Salary</th></tr>";
while($row = mysqli_fetch_assoc($result)){
echo"<tr><th>$row[EmpID]</th><th>$row[Name]</th><th>$row[Department]</th><th>$row[Salary]</th>";
}
?>
<button id="d"> print </button>
<a href="Home.php"><button id='back'>Back</button></a>
<script>
function hi(){
window.print();
}
const x=document.getElementById("d");
x.addEventListener('click',hi);
</script>