I need to add a nested table to my php page so that when I put it in my browser, just a table will appear with 2 columns and 3 rows. In the top left column I need the word "WIDTH", and right below that it will say "HEIGHT". The bottom box should be merged with a "SUBMIT" button. The top right and middle boxes will be blank, but when you add numbers to the 2 boxes, ie. 3 on top and 4 in the middle and hit the "SUBMIT" button, a 3 X 4 tables will come up. You should be able to add any numbers to the boxes and that size table will come up ie. 10 X 10 and so on. Can anyone please give me a hand. Below is what I have and I just can't figure it out. I guess it's called a nested loop construct. I appreciate any help that I get!
Respectfully
<?php
$width = 10;
$height = 10;
functionreateTable($width, $height)
{
$i =1;
$table = '<table border = "1">';
for ($r = 0; $r <$width; $c++)
{
$table .= '<tr>';
for <table ,= "<td> $i </td>;
$ i++;
}
$table .= <tr>';
}
$table .= '</table>';
return $table;
}
echo createTable ($width, $height);
?>
burt.munn 0 Light Poster
diafol
diafol
burt.munn 0 Light Poster
diafol
burt.munn 0 Light Poster
diafol
burt.munn 0 Light Poster
burt.munn 0 Light Poster
diafol
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.