mainPage.php 761 B

12345678910111213141516171819202122232425
  1. <main>
  2. <?php
  3. $coordinatorID = $_SESSION['login_user'];
  4. $sql = "SELECT subjectName, description FROM subjects WHERE coordinatorID = '$coordinatorID'";
  5. $result = mysqli_query($db, $sql);
  6. $count = 0;
  7. while ($row = mysqli_fetch_assoc($result)) {
  8. addSubjectOption($row['subjectName'], $row['description']);
  9. $count = $count + 1;
  10. }
  11. if ($count == 0) {
  12. echo '<center><h1>You do not have any subjects assigned</h1></center>';
  13. }
  14. function addSubjectOption($name, $description)
  15. {
  16. echo '<form action="/teacher/teacher.php" method="POST">' .
  17. "<p>" . $description . "</p>" .
  18. '<input type="submit" value="' . $name . '" name="subjectPanel"></form>';
  19. }
  20. ?>
  21. </main>