<?php
    include 'db_conn.php';

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

    $labelOptions = [
        'innerHTML' => ''
    ];

    foreach ($results as $label) {
        $labelOptions['innerHTML'] = $labelOptions['innerHTML'] . '<label><input type="checkbox" name="labelID[]" value="' . $label['label_id'] . '"><span>' . $label['label'] . '</span></label>';
    }

    echo $labelOptions['innerHTML'];
?>
