Web Technology
Web Technology
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST['name'];
$hours = (int)$_POST['hours'];
$rate = (float)$_POST['rate'];
<!DOCTYPE html>
<html>
<head>
<title>Pay Slip Details</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { border: 1px solid black; padding: 10px; text-align: center; }
th { background-color: #f2f2f2; }
</style>
</head>
<body>
<h2>Employee Salary Details</h2>
<table>
<tr>
<th>Name</th>
<th>Working Hours</th>
<th>Hourly Rate</th>
<th>Gross Salary</th>
</tr>
<?php foreach ($_SESSION['employees'] as $employee): ?>
<tr>
<td><?php echo htmlspecialchars($employee['name']); ?></td>
<td><?php echo $employee['hours']; ?></td>
<td><?php echo $employee['rate']; ?></td>
<td><?php echo number_format($employee['gross_salary'], 2); ?></td>
</tr>
<?php endforeach; ?>
</table>
<h3>Total Salary Paid: <?php echo number_format($total_salary, 2); ?></h3>
</body>
</html>
- Stores the data using PHP sessions to keep a cumulative record of employees.