question_multiple_form.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <main>
  2. <?php
  3. if (!isset($_SESSION['IDupd'])) {
  4. include($root . "/teacher/pageParts/questionToggle.php");
  5. } else {
  6. $ID = $_SESSION['IDupd'];
  7. $sql = "SELECT * FROM questions WHERE questionID = '$ID'";
  8. $result = mysqli_query($db, $sql);
  9. $row = mysqli_fetch_assoc($result);
  10. $question = $row['questionDescription'];
  11. $correctPoints = $row['correctPoints'];
  12. $wrongPoints = $row['assHolePoints'];
  13. $answerA = $row['descriptionAnswerA'];
  14. $answerB = $row['descriptionAnswerB'];
  15. $answerC = $row['descriptionAnswerC'];
  16. $answerD = $row['descriptionAnswerD'];
  17. $answer = $row['answerABCD'];
  18. } ?>
  19. <div class="form">
  20. <form action="/teacher/logic/formLogic.php" method="POST">
  21. <label for="question">Question</label>
  22. <input type="text" id="question" name="question" placeholder="question text.." <?php if(isset($question)){echo "value = '$question'";}?> required>
  23. <label for="addPoints">Points for correct answer (0-10)</label>
  24. <input type="number" id="addPoints" name="addPoints" step="0.01" min="0" max="10" <?php if(isset($correctPoints)){echo "value = '$correctPoints'";}?> required><br>
  25. <label for="cutPoints">Minus points for wrong answer (0-10)</label>
  26. <input type="number" id="cutPoints" name="cutPoints" step="0.01" min="0" max="10" <?php if(isset($wrongPoints)){echo "value = '$wrongPoints'";}?> required><br><br>
  27. <input type="radio" name="answer" value="A" id="A" <?php if(isset($answer)){if($answer == 'A'){echo 'checked';}}else{echo 'checked';}?> />
  28. <label for="true">A</label>
  29. <input type="text" id="answerA" name="answerA" placeholder="answer text.." <?php if(isset($answerA)){echo "value = '$answerA'";}?> required>
  30. <input type="radio" name="answer" value="B" id="B" <?php if(isset($answer)){if($answer == 'B'){echo 'checked';}}?>/>
  31. <label for="true">B</label>
  32. <input type="text" id="answerB" name="answerB" placeholder="answer text.." <?php if(isset($answerB)){echo "value = '$answerB'";}?> required>
  33. <input type="radio" name="answer" value="C" id="C" <?php if(isset($answer)){if($answer == 'C'){echo 'checked';}}?>/>
  34. <label for="true">C</label>
  35. <input type="text" id="answerC" name="answerC" placeholder="answer text.." <?php if(isset($answerC)){echo "value = '$answerC'";}?> required>
  36. <input type="radio" name="answer" value="D" id="D" <?php if(isset($answer)){if($answer == 'D'){echo 'checked';}}?>/>
  37. <label for="true">D</label>
  38. <input type="text" id="answerD" name="answerD" placeholder="answer text.." <?php if(isset($answerD)){echo "value = '$answerD'";}?> required>
  39. <input type="submit" value="Submit">
  40. </form>
  41. </div>
  42. </main>