Jump to content

Php Math Form


phpgoal

Recommended Posts

Hi,

 

I am trying to do math test page. When i submit the form, how can i get the value of $num1 & $num2 in submit.php page?

 

Its not working at all. Please advise.

 

 

1. form.php

 

<html>

<?php

 

$num1 = mt_rand(1,20);

$num2 = mt_rand(2,9);

 

echo "<form name="lab5" method="post" action="Submit.php">

 

echo "<table border=1 cellspacing=0 cellpading=0>

<tr> <td> Q1 </td> <td> $num1 * $num2 </td> <td> <input type = 'text' size = '2' name = one > </td> </tr>

<tr><td> $num1 * 4> <input type='submit' value='Score' name='btn_score'></td></tr>

 

</table>";

</form> " ;

?>

</html>

 

 

2. Submit.php

 

<?php

$OneResult = $num1 * $num2 ;

$UserV=$_POST['one'];

?>

Link to comment
https://forums.phpfreaks.com/topic/272138-php-math-form/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.