This is being developed for use by students on their mobiles.
www.edufacts.info In Maths section.
/timetable1.php
2 random numbers are generated and displayed. Students inputs their answer, click submit.
/timetable2.php
Displays "Correct" else "Wrong answer, should be xx"
How can you send the two randomly generated numbers to the second .php file? I cannot see how you can use the Form. It errors any PHP inside <form></form>
Can it be done on one PHP page?
Can you input data directly into PHP rather than using <input> method.
/timetable1.php
<form method="get" enctype="multipart/form-data" action="http://www.dtscan.com/mobile/timestable2.php">
<?php
$n1 = rand (1, 12);
$n2 = rand (1, 12);
print "Multiply $n1 by $n2 <br />";
?>
What is your answer<br />
<input type="text" name="answer" size="2" />
<input type="submit" name="submit" value="Check Answer" />
</form>
/timetable2.php
<?php
$answer = $_GET['answer'];
$n1 = $_GET['an1'];
$n2 = $_GET['an2'];
$ans = $n1 * $n2;
if ($answer == $ans) {print "Correct Answer";}
else {print "Correct Answer is $ans";}
?>
You might notice that my PHP files are held on another server. I took me a day to find out my original server is not PHP enabled.
POST does not work on Mobile phones. Another day to discover that.
Tony Bell