Employee - List Final
Employee - List Final
php
if (isset($_SESSION['message'])) {
echo "<div class='message'>" . $_SESSION['message'] . "</div>";
unset($_SESSION['message']);
}
?>
<?php
session_start();
if (!isset($_SESSION['username'])) {
header('Location: login.php');
exit;
}
// Database connection
$conn = new mysqli('localhost', 'root', '', 'payroll_system');
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Employee List - Payroll System</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Arial', sans-serif;
background-color: #f0f2f5;
display: flex;
min-height: 100vh;
}
.sidebar {
width: 250px;
background: linear-gradient(135deg, #007bff, #0056b3);
color: #fff;
height: 100vh;
position: fixed;
padding: 20px;
}
.sidebar h2 {
font-size: 24px;
margin-bottom: 20px;
text-align: center;
}
.sidebar ul {
list-style: none;
padding: 0;
}
.sidebar ul li {
margin: 15px 0;
}
.sidebar ul li a {
color: #fff;
text-decoration: none;
font-size: 18px;
display: block;
padding: 10px;
border-radius: 5px;
}
.sidebar ul li a:hover {
background-color: #0056b3;
}
.content {
margin-left: 270px;
padding: 40px;
flex: 1;
}
.content h1 {
font-size: 28px;
margin-bottom: 20px;
color: #333;
}
.button-container {
margin-bottom: 20px;
}
.button-container a button {
padding: 10px 15px;
background-color: #28a745;
color: white;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
}
.button-container a button:hover {
background-color: #218838;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
table, th, td {
border: 1px solid #ddd;
}
th, td {
padding: 12px;
text-align: left;
}
th {
background-color: #007bff;
color: white;
}
tr:nth-child(even) {
background-color: #f2f2f2;
}
.action-btns a {
text-decoration: none;
padding: 5px 10px;
background-color: #007bff;
color: white;
border-radius: 5px;
}
.action-btns a:hover {
background-color: #0056b3;
}
.message, .error {
margin-top: 20px;
}
</style>
</head>
<body>
<!-- Sidebar -->
<div class="sidebar">
<h2>Payroll System</h2>
<ul>
<li><a href="dashboard.php">Dashboard</a></li>
<li><a href="employee_list.php">Employee List</a></li>
<li><a href="#">Payroll List</a></li>
<li><a href="department_list.php">Department Lists</a></li>
<li><a href="position_list.php">Position Lists</a></li>
<li><a href="allowance_list.php">Allowance Lists</a></li>
<li><a href="deduction_list.php">Deduction Lists</a></li>
<li><a href="projects.php">Project Lists</a></li>
<li><a href="attendance_list.php">Attendance</a></li>
<li><a href="list_users.php">Admin Account Lists</a></li>
<li><a href="logout.php">Logout</a></li>
</ul>
</div>
<td class="action-btns">
</tr>
<?php endwhile; ?>
</tbody>
</table>
<?php else: ?>
<p>No employees found.</p>
<?php endif; ?>
<?php
// Close the database connection
$conn->close();
?>
</div>
</body>
</html>