<!DOCTYPE html>
<html lang="fr">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="../styles/main.css" />
    <link rel="stylesheet" href="../styles/header.css" />
    <link rel="stylesheet" href="../styles/footer.css" />
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet" />

    <link rel="icon" type="image/png" sizes="32x32"
        href="https://tickets.paris2024.org/obj/media/FR-Paris2024/specialLogos/favicons/favicon-32x32.png" />
    <title>Évènements | Jeux Olympiques - Paris 2024</title>
</head>

<body>
    <?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/header.php') ?>

    <!-- code de la page ici -->
    <h1>Évènements</h1>
    <?php
    if (isset($_POST['discipline'])) {
        $selectedDiscipline = $_POST['discipline'];
        $descriptionResult = mysqli_query($db, "SELECT description FROM `olympic_discipline` WHERE discipline = '$selectedDiscipline'");
        while ($row = mysqli_fetch_assoc($descriptionResult)) {
            echo "<p class='text'>" . $row['description'] . "</p>";
        }
    }
    ?>

    <form method="POST">
        <?php
        $evenement = mysqli_query($db, "SELECT discipline FROM `olympic_discipline` ");
        echo "<select name='discipline'>";
        while ($row = mysqli_fetch_assoc($evenement)) {
            echo "<option>" . $row['discipline'] . "</option>";
        }
        echo "</select>";
        ?>
        <button><input type="submit" value="Afficher la description"></button>
    </form>



    <?php include ($_SERVER['DOCUMENT_ROOT'] . '/views/footer.php') ?>


</body>

</html>