I am currently trying to make a four question quiz. Each question is on a new page. There will be a previous button and a next button to take the user to the previous and next question respectively. There will also be a save button to save the current answer selected for the questions so far. Finally, I will have a submit button that will submit all the answers of the quiz and give back a score. I have to use these buttons, and I have to have my page setup in this way. However, I am not sure how I should handle the buttons.
I currently have my HTML file as such which will send to a php file:
- <h1>Music Quiz</h1>
-
<form action = "exam1.php" method = "post">
-
<p>
-
Which of the following composers were NOT famous during the
-
Renaissance period (1600-1750)? <br />
-
<select name = "questionOne">
-
<option></option>
-
<option value = "Guillaume Dufay">Guillaume Dufay</option>
-
<option value = "Josquin des Prez">Josquin des Prez</option>
-
<option value = "Henry Purcell">Henry Purcell</option>
-
<option value = "Palestrina">Palestrina</option>
-
</select>
-
</p>
-
<p>
-
<input type ="button" value="Previous Question" />
-
<input type = "submit" value = "Save" />
-
<input type = "submit" value = "Submit" />
-
<input type = "button" value = "Next Question" />
-
</p>
-
</form>
The PHP file can print the next question if the next question button was selected, etc. I should be able to handle everything in the php file. However, I don't know how to determine which buttons were pressed in my php file. How should I handle the next and previous buttons? How do I know which submit button was selected? Any help will be greatly appreciated.