Jump to content

how do I do the multiplication table for php?


xaznbabyx

Recommended Posts

My teacher only says he wants user to enter a number for the size of the table and keep the the size is between 1 and 10, inclusive. It is not working and I don't get how to enter the number for the size, I think I am missing something?

 

Im am not sure if what I am doing is correctly. 

 
http://hills.ccsf.edu/~schow11/cs130a/hw4.php

<?php 
 
$cols = 11;
$rows = 11;
 
print '<table border="1">';
 
for ($n = 1; $n < $rows; $n++){
print '</tr>';
 
for ($i = 1; $i < $cols; $i++)
print '<td>' .$i*$n. '</td>'; 
print '</tr>';
 
}
 
print "</table>"
 
?>

Create a set of PHP pages that allows the user to create a square multiplication table. The first page should contain one text box that asks the user the size of the multiplication table. Note, there should only one text box. Not two text boxes (one for the rows and one for the columns). The second page displays the multiplication table, which must include the numbers being multiplied and the answers. For example, your multiplication table could look like this: 

http://imgur.com/jyJnKBg
 
In addition to creating the multiplication table, you page should:

  • Ensure that the user enters a number for the size of the table.
  • Ensure that the size is between 1 and 10, inclusive.
Edited by xaznbabyx
Link to comment
Share on other sites

My teacher only says he wants user to enter a number for the size of the table and keep the the size is between 1 and 10, inclusive. It is not working and I don't get how to enter the number for the size, I think I am missing something?

 

Have you looked into using HTML form data with PHP? A quick example can be found here:

http://php.net/manual/en/tutorial.forms.php

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.