
<link rel="stylesheet" href="assets/vendors/mdi/css/materialdesignicons.min.css">
    <link rel="stylesheet" href="assets/vendors/css/vendor.bundle.base.css">
<?php
// Database connection
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "elvieg_editpost";

$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Fetch data based on selected option
$option = $_POST['option'];
$sql = "SELECT * FROM permbo2022to2026 WHERE mbo = '$option'";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    $row_color = 0;
    echo "<table class='table table-bordered'>";
    echo "<thead>";
    echo "<tr class='table-primary'><th>Ctrlnum</th><th>MBO</th><th>Code</th><th>Description</th> <th>2022 Actual</th><th>2023 Target</th><th>2023 Actual </th></tr>";
    echo "</thead>";
    echo "<tbody>";
    while ($row = $result->fetch_assoc()) {
        $color_class = $row_color % 2 == 0 ? 'table-warning' : 'table-success ';

        echo "<tr class='$color_class''>";
        echo "<td>" . $row['ctrlnum'] . "</td>";
        echo "<td>" . $row['mbo'] . "</td>";
        echo "<td>" . $row['indicatorcode'] . "</td>";
        echo "<td class='text-wrap'>" . $row['description'] . "</td>";
        echo "<td>" . $row['baseline'] . "</td>";
        echo "<td>" . $row['y2target'] . "</td>";
        echo "<td>" . $row['y2actual'] . "</td>";
        echo "</tr>";
        $row_color++;
    }
    echo "</tbody>";
    echo "</table>";
} else {
    echo "No data found";
}
$conn->close();
?>