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