prepare("INSERT INTO employees (first_name, last_name, email, designation, base_salary) VALUES (?, ?, ?, ?, ?)"); $stmt->execute([$first_name, $last_name, $email, $designation, $base_salary]); $success_message = "Employee ''' . htmlspecialchars($first_name . ' ' . $last_name) . ''' added successfully!"; } catch (PDOException $e) { if ($e->errorInfo[1] == 1062) { // Duplicate entry $errors[] = "An employee with this email already exists."; } else { $errors[] = "Database error: " . $e->getMessage(); } } } } // Fetch all employees $stmt = $pdo->query("SELECT id, first_name, last_name, email, designation, base_salary FROM employees ORDER BY created_at DESC"); $employees = $stmt->fetchAll(); $project_name = htmlspecialchars($_SERVER['PROJECT_NAME'] ?? 'SalaryBook'); $project_description = htmlspecialchars($_SERVER['PROJECT_DESCRIPTION'] ?? 'Smart Payroll Management System'); ?> <?= $project_name ?> - Employee Management

Add New Employee

Current Employees

Name Email Designation Salary
No employees found. Add one to get started!
$