dunn_cann Posted January 8, 2007 Share Posted January 8, 2007 Have been trying to follow this multiplication table tutorial but can't get it right. Could someone point out where i'm going wrong with this table please.[code]HTML Code<html><head><title>HTML Form</title></head><body><form action="table_results.php" method="post"> Enter the multiplication table number<input type="text" name="table" size="2"><input type="submit"></form></body></html>PHP Code:<html><head><title>Table_Results</title></head><body><?php$cnt = 1;$table = $_post['table'];while($cnt != 11){echo "$table x $cnt = ".$table * $cnt;$cnt++;}?></body></html>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/33351-solved-table-all-wrong/ Share on other sites More sharing options...
Jessica Posted January 8, 2007 Share Posted January 8, 2007 I think you have to use $_POST not $_post.What does it print out? "Not right" doesn't help much. Quote Link to comment https://forums.phpfreaks.com/topic/33351-solved-table-all-wrong/#findComment-155831 Share on other sites More sharing options...
dunn_cann Posted January 8, 2007 Author Share Posted January 8, 2007 If i was to type in the number 10 the result i would get is below:10 x 1 = 1010 x 2 = 2010 x 3 = 3010 x 4 = 4010 x 5 = 5010 x 6 = 6010 x 7 = 7010 x 8 = 8010 x 9 = 9010 x 10 = 100 Thanks for any and all help. Quote Link to comment https://forums.phpfreaks.com/topic/33351-solved-table-all-wrong/#findComment-155834 Share on other sites More sharing options...
Jessica Posted January 8, 2007 Share Posted January 8, 2007 So what is the problem? Do you just want to break up the lines?[code]echo "$table x $cnt = ".($table * $cnt).'<br />';[/code] Quote Link to comment https://forums.phpfreaks.com/topic/33351-solved-table-all-wrong/#findComment-155843 Share on other sites More sharing options...
dunn_cann Posted January 8, 2007 Author Share Posted January 8, 2007 It's suppose to be a multiplication table but it's not displaying the correct answers and they are all on the same line? Quote Link to comment https://forums.phpfreaks.com/topic/33351-solved-table-all-wrong/#findComment-155851 Share on other sites More sharing options...
Clarkey_Boy Posted January 8, 2007 Share Posted January 8, 2007 Yes, the <br> means line break - the next calculation would appear on the next line.RC Quote Link to comment https://forums.phpfreaks.com/topic/33351-solved-table-all-wrong/#findComment-155855 Share on other sites More sharing options...
Jessica Posted January 8, 2007 Share Posted January 8, 2007 Last time I checked, 10 times 1 was 10.You need line breaks, like I said. Quote Link to comment https://forums.phpfreaks.com/topic/33351-solved-table-all-wrong/#findComment-155861 Share on other sites More sharing options...
dunn_cann Posted January 8, 2007 Author Share Posted January 8, 2007 Agh! Now i can see what you mean. Thanks for the help and patience. Quote Link to comment https://forums.phpfreaks.com/topic/33351-solved-table-all-wrong/#findComment-155882 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.