Please Help... Need PHP script to generate table based HTML code...

My task is create a PHP script that will create an HTML table with the number of rows and columns specified by the user, with the row and column number inside the cell. Any ideas or suggestions are greatly appreciated!

My HTML code is as follows

[code]

Table Creator

Table Creator

&nbspNumber of rows:&nbsp 1 2 3 4 5 6 7

&nbspNumber of columns:&nbsp 1 2 3 4 5 6 7


[/code]

Make sure sure you put this code in a php file

[php]

<?php if (isset($_GET['submit'])) { // set variables from form input $rows = $_GET['rows']; $columns = $_GET['columns']; echo "\n"; // loop to create rows for ($r = 1; $r <= $rows; $r++) { echo "\n"; // loop to create columns for ($c = 1; $c <= $columns;$c++) { echo " "; } echo " "; } echo "
 
"; } ?> Table Creator

Table Creator

&nbspNumber of rows:&nbsp 1 2 3 4 5 6 7

&nbspNumber of columns:&nbsp 1 2 3 4 5 6 7


[/php]

good luck.

Sponsor our Newsletter | Privacy Policy | Terms of Service