phpgoal Posted December 18, 2012 Share Posted December 18, 2012 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 More sharing options...
MDCode Posted December 18, 2012 Share Posted December 18, 2012 Cookies, Sessions, Use the URL or hidden fields. So many possibilities Link to comment https://forums.phpfreaks.com/topic/272138-php-math-form/#findComment-1400100 Share on other sites More sharing options...
phpgoal Posted December 18, 2012 Author Share Posted December 18, 2012 I am confused. Could you help? Link to comment https://forums.phpfreaks.com/topic/272138-php-math-form/#findComment-1400117 Share on other sites More sharing options...
MDCode Posted December 18, 2012 Share Posted December 18, 2012 Session Handling Cookies $_POST $_GET All you need to know is in these 4 links. Link to comment https://forums.phpfreaks.com/topic/272138-php-math-form/#findComment-1400124 Share on other sites More sharing options...
phpgoal Posted December 18, 2012 Author Share Posted December 18, 2012 Thanks. I will study those. Link to comment https://forums.phpfreaks.com/topic/272138-php-math-form/#findComment-1400131 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.