<?php
    include 'db_conn.php';
    $stmt = $db->prepare('SELECT Labels.* FROM Labels');
    $stmt->execute();
    $results = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>

<div id="addLabelPanel">
    <h2>Create new label</h2>
    <form action="" autocomplete="off" method="POST">
        <input type="text" name="newLabelName" size="12"><br>
        <select class="labelSelect" name="labelColor">
            <option value="1">Red</option>
            <option value="2">Pink</option>
            <option value="3">Indigo</option>
            <option value="4">Purple</option>
            <option value="5">Blue</option>
            <option value="6">Light blue</option>
            <option value="7">Cyan</option>
            <option value="8">Green</option>
            <option value="9">Light green</option>
            <option value="10">Lime</option>
            <option value="11">Yellow</option>
            <option value="12">Amber</option>
            <option value="13">Orange</option>
            <option value="14">Deep orange</option>
            <option value="15">Deep purple</option>
        </select><br>
        <input type="submit" class="labelSubmitButton" value="Submit">
    </form>
</div>
<div id="removeLabelPanel">
    <h2>remove label</h2>
    <form action="" autocomplete="off" method="POST">
        <select name="removedLabel">
            <?php
            foreach ($results as $row) {
                if ($row["label_id"] != 0) {
                    echo '<option value ='.$row["label_id"].'>'.$row['label'].'<br></option>';
                }
            }
            ?>
        </select><br>
        <input type="submit" id="labelRemoveSubmitButton" value="Submit">
    </form>
</div>
