CSc 302 Assignment 5

Math Is Hard


Oct 25
50 pts
Nov 3

Use PHP to create a simple flash-card web page that a child might use to learn the multiplication tables. Use an arrangement similar to the guessing game example, where a single script displays a page containing a form, and also processes the output of the form to display another. Your page should have the following behavior:

When loaded from an ordinary link (no data is sent), display a multiplication question. Ask for the result of multiplying two numbers chosen at random from the range 1 to 10. Provide an entry box for the answer, and a submit button. The answer should be sent back to the same PHP script.

When loaded from the submit button (data is sent), display a message saying if the answer is correct, or that it is not and give the correct answer. Also, keep track of the total number of questions asked, and the number correct, and display these statistics. Count from the initial question generated by the plain link. Below this information, display a new question of the same form as the initial page. This one is also submitted back to the the same PHP script, so the user may continue as long as desired.

Word and style your page in an attractive manner, keeping in mind that the intended user would be a schoolchild. You may want to use large fonts and bright colors.

The guessing game code will be useful as a guide. You will want to use the rand() function to generate the numbers for your questions, and use the make use of the hidden type form fields to communicate from one invocation to the next. Particularly, when an answer is sent back to the form, hidden fields will have to carry the question with it. You will also need them to keep track of the question and correct answer counts.

When you're ready, post your page on Sandbox, then go here and enter the URL of the page.