<?php require "includes/functions.php" ?>
<!DOCTYPE HTML>
<html lang="it">

<head>
    <title>Login</title>
    <?php require "includes/head.php" ?>
</head>

<body>

<div class="container">
    <h1>Login</h1>
    <?php
    if (isset($_SESSION["error"])) {
        ?>
        <div class="alert alert-danger" role="alert">
            <?php echo $_SESSION["error"] ?>
        </div>
    <?php }
    session_destroy();
    ?>
    <form action="index.php" method="post">
        <div class="mb-3">
            <label for="nome" class="form-label">Nome</label>
            <input type="text" class="form-control" id="nome" name="nome">
        </div>
        <div class="mb-3">
            <label for="sceltaHobby" class="form-label">Ti piace maggiormente:</label>
            <select class="form-select" name="sceltaHobby" id="sceltaHobby">
                <option value="m" selected>Musica</option>
                <option value="s">Sport</option>
            </select>
        </div>

        <button type="submit" class="btn btn-primary">Invia Risposta</button>
    </form>
    <p>
        Il JSON é stato modificato per far diventare le domande degli array (domanda, risposta)
    </p>
</div>

<?php require "includes/footer.php" ?>

</body>
</html>