<!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="reserv.css">
    <link href="https://fonts.googleapis.com/css2?family=Nova+Square&display=swap" rel="stylesheet">
    <link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
    <link rel="shortcut icon" href="img/favicon.webp">
    <title>Formulaire</title>
</head>
<body>

<section class="header">
    <nav class="navbar">
        <li class="logo"><a href="index.php"><img src="img/Resa.png" alt="acceuil RésaKingdom"></a></li>
    </nav>
    <div class="sombre">
        <div class="container">
        <?php
            include 'conn.php';
        ?>
        
            <?php
        if (isset($_GET['id'])) {
            $id_activite = $_GET['id'];
            $stmt = $db->prepare('SELECT id_destination, nom, description, img FROM rek_destination WHERE id_destination = :id');
            $stmt->bindParam(':id', $id_activite);
            $stmt->execute();
            $result = $stmt->fetch(PDO::FETCH_ASSOC);

            echo '<div class="activite_reveal">';
            echo "<img src='{$result["img"]}' alt='image d'illustration de la destination'>";
            echo '<h2>' . $result["nom"] . '</h2>';
            echo '</div>';
            echo '<p>' . $result["description"] . '</p>';
        } else {
            echo 'Aucune activité spécifiée.';
        }
        ?>
        </div>
    </div>
</section>
    
    <section class="formulaire">

        <form action="ajout_reserv.php" method='POST'>
    <fieldset>
        <legend>Réserver votre voyage :)</legend>
        
        <label for="nom">Entrer votre nom</label>
        <input type="text" id="nom" name="nom" placeholder="Jhon" required/>
        <br>
        <label for="prenom">Entrer votre prénom</label>
        <input type="text" id="prenom" name="prenom" placeholder="Doe" required/>
        <br>
        <label for="email">Entrer votre adresse mail</label>
        <input type="email" id="email" name="email" placeholder="JhonDoe@gmail.com" required/>
        <br>
        <label for="date">Entrez la date de votre voyage</label>
        <input type="date" id="date" name="date" required/>
        <br>
        <label for="destination">Selectionnez votre destination</label>
        <select id="destination" name="destination" required>
            <option value="">Selectionnez votre destination</option>
            <?php
                $requete="SELECT * FROM rek_destination";
                $stmt=$db->query($requete);
                $result=$stmt->fetchall(PDO::FETCH_ASSOC);
                $selected_id = isset($_GET['id']) ? $_GET['id'] : '';

                foreach ($result as $destination){
                    $selected = $destination["id_destination"] == $selected_id ? 'selected' : '';
                    echo"<option value='{$destination["id_destination"]}' $selected>{$destination['nom']}</option>";
                }
            ?>
        </select>
        <br>
        <input type="submit" value="envoyer">
    </fieldset>
</form>


  
</section>
     <footer>
         <a href="a_propos.html">A propos</a> <br>
        <p>Site édité par Colheen NKODIA-DIABATÉ (cnkodiadiabate@edu.univ-eiffel.fr) dans le cadre de la SAE 2.03 © Colheen NKODIA-DIABATÉ, 2024. Héberger sur O2switch</p>
    </footer>

</body>
</html>


