I need assistance in generating an online quiz via PHP, HTML, and possibly JavaScript. I want to generate 10 sets of math problems with random numbers. I have successfully used the rand() function with lower and upper limits to generate the question values. For each problem, I want the user to see a refreshed screen with the problem and then enter the answer for that problem. I have successfully set up an HTML <form> to accepted the answer. After all 10 problems have been asked and answered, I want to display all 10 problems with the user's corresponding answers (to summarize what was asked and the matching reply). I am having difficulty saving the 10 sets of values for the geneated numbers and the user's 10 inputted answers. I initially set up the PHP module to issue a <form> with method="post". When I viewed the values of the variables, I only saw the value entered in the current form. The previously generated values and input answers were lost (and came up a null or blank). So how can I retain all values as I go back and forth between question and answer (with a screen refresh each time)?
Why not use PHP built-in session mechanism? Session is a way to store user data on the server. It is exactly what you need. All the handling is automatic -- all you have to do is just store your data. Google for "PHP sessions". You should find something useful.
I am fairly new to PHP programming and was not familiar with the Session feature. It incorporated it into my quiz processing, and it worked exactly as I needed it to do!!! Thank you so much for the recommendation.
you can use hidden forms(<input type=hidden >) to store the questions and answers and pass them from the question page to the result page and then pass them from result page to answer showing page.