<h1>Gästebuch</h1>
<?php
if ((!isset($_POST['new'])) and (!isset($_POST['edit'])) and (!isset($_POST['del']))) {
    $sql1 = 'SELECT * FROM gb';
    $result1 = $db->query($sql1);
    ?>
    <fieldset>
        <form action="index.php?section=gb" method="post">
            <fieldset>
                <legend>neuen Gästebucheintrag hochladen</legend>
                <input type="submit" name="new" value="Hochladen"/>
                <br/>
            </fieldset>
            <br/>
            <select name="Titel">
                <?php
                while ($nt1 = $result1->fetch_assoc()) {
                    echo '<option value="' . $nt1['ID'] . '">' . $nt1['ID'] . ' ' . $nt1['Autor'] . '</option>';
                }
                ?>
            </select>
            <br/>
            <fieldset>
                <legend>Gästebucheintrag ändern</legend>
                <input type="submit" name="edit" value="Bearbeiten"/>
                <br/>
            </fieldset>
            <br/>
            <fieldset>
                <legend>Gästebucheintrag löschen</legend>
                <input type="submit" name="del" value="Löschen"/>
                <br/>
            </fieldset>
    </fieldset>

    <?php
} else {
    if (isset($_POST['new'])) {
        include "inhalte/gb/new.php";
    } elseif (isset($_POST['edit'])) {
        include "inhalte/gb/edit.php";
    } elseif (isset($_POST['del'])) {
        include "inhalte/gb/del.php";
    } else {
        echo "Fehler";
    }
}