checkExams.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. $root = $_SERVER['DOCUMENT_ROOT'];
  3. include($root . "/util/session.php");//checks that the user is logged in
  4. include($root . "/util/privilege_check.php");
  5. checkPrivilege("student");
  6. //$query = "SELECT FROM subjects join users on users.username = students_subjects.studentID join students_subjects ";
  7. $curuser=$_SESSION['login_user'];
  8. $query = "SELECT subjects.subjectName from subjects where subjects.subjectID in (select students_subjects.subjectID from students_subjects where students_subjects.studentID='$curuser')";
  9. $result = mysqli_query($db,$query);
  10. if(mysqli_num_rows($result) < 1){
  11. $error = "No users, how did you get here?";
  12. }
  13. #$row=mysqli_fetch_assoc($result);
  14. #echo $row['subjectID'];
  15. ?>
  16. <html>
  17. <head>
  18. <title>Check and do exams</title>
  19. <link rel="stylesheet" type="text/css" href="studentStyle.css">
  20. </head>
  21. <body>
  22. <?php
  23. include($root . "/student/header.php")
  24. ?>
  25. <li><a href="/student/student.php">Back</a></li>
  26. <div id="menu">
  27. <ul>
  28. <b>Subjects</b>
  29. <?php
  30. while($row = mysqli_fetch_assoc($result)){
  31. echo '<form action="/student/subjectExams.php" method="POST">' .
  32. '<input type="submit" value="' . $row["subjectName"] . '" name="actualSubject"></form>';
  33. }
  34. ?>
  35. </ul>
  36. </div>
  37. <?php
  38. include($root . "/student/footer.php")
  39. ?>
  40. </body>
  41. </html>