I want to create a list of checkboxes with values from a php array as its label. I want it to look like
Here is the list of students whose schedules are saved:
[checkbox] Robb
[checkbox] Catelyn
[checkbox] Lady Stoneheart
but my code does not work.
Here's my code:
<?php
$students = $_SESSION['students'];
echo "Here is the list of students whose schedules are saved:<br/><br/>";
echo "<form action='checkbox-form.php' method='post'>
Load student?<br/>";
foreach ($students as $stud) {
echo "<br/><input type='checkbox' name=" . $stud . " value='load' />";
}
echo "<br/><br/><input type='submit' name='formSubmit' value='Submit' />
</form>";
?>
The array is not the problem because it contains the proper values when I print it through foreach.