### Instruction:
Design a PHP web application that manages employee records. The application should use MySQL as the database and provide functionalities to add, edit, view, and delete employees. Each employee record should contain first name, last name, job title, department, and hire date.
PLAINFORMAT

### Response:

<?php
// config.php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "employee_management";

$conn = new mysqli($servername, $username, $password, $dbname);

if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
?>

<!DOCTYPE html>
<!-- index.php -->
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Employee Management</title>
</head>
<body>
    <h1>Employee Management</h1>
    <a href="add_employee.php">Add Employee</a>
    <table border="1">
        <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Job Title</th>
            <th>Department</th>
            <th>Hire Date</th>
            <th>Action</th>
        </tr>
        <?php
        $sql = "SELECT * FROM employees";
        $result = $conn->query($sql);

        if ($result->num_rows > 0) {
            while($row = $result->fetch_assoc()) {
                echo "<tr>";
                echo "<td>" . $row["id"] . "</td>";
                echo "<td>" . $row["first_name"] . " " . $row["last_name"] . "</td>";
                echo "<td>" . $row["job_title"] . "</td>";
                echo "<td>" . $row["department"] . "</td>";
                echo "<td>" . $row["hire_date"] . "</td>";
                echo '<td><a href="view_employee.php?id=' . $row["id"] . '">View</a> | <a href="edit_employee.php?id=' . $row["id"] . '">Edit</a> | <a href="delete_employee.php?id=' . $row["id"] . '">Delete</a></td>';
                echo "</tr>";
            }
        } else {
            echo "<tr><td colspan='6'>No records found</td></tr>";
        }
        $conn->close();
        ?>
    </table>
</body>
</html>

<!DOCTYPE html>
<!-- add_employee.php -->
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Add Employee</title>
</head>
<body>
    <h1>Add Employee</h1>
    <form action="insert_employee.php" method="post">
        First Name: <input type="text" name="first_name" required><br>
        Last Name: <input type="text" name="last_name" required><br>
        Job Title: <input type="text" name="job_title" required><br>
        Department: <input type="text" name="department" required><br>
        Hire Date: <input type="date" name="hire_date" required><br>
        <input type="submit" value="Add Employee">
    </form>
</body>
</html>

<?php
// insert_employee.php
include 'config.php';

$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$job_title = $_POST['job_title'];
$department = $_POST['department'];
$hire_date = $_POST['hire_date'];

$sql = "INSERT INTO employees (first_name, last_name, job_title, department, hire_date) VALUES ('$first_name', '$last_name', '$job_title', '$department', '$hire_date')";

if ($conn->query($sql) === TRUE) {
    header("Location: index.php");
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();
?>
