Click here to Skip to main content
14,695,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can we create a table dynamically in php, providing the number of columns in a text box ?
The table should be created at run time.
Plz give me the answer.
ZurdoDev 19-Jul-12 14:25pm
Do you know php?
markkuk 20-Jul-12 5:28am
HTML table, SQL table or some other sort of table? Please be more specific.

1 solution

What you need to do is something like this:

$rows = 10; // define number of rows
$cols = 4;// define number of columns

echo "<table border='1'>";


    echo "<tr>";
               echo "<td>row: ".$tr." column: ".$td."</td>";
    echo "</tr>";

echo "</table>";

To receive the number of columns from a form use either the POST or GET methods.
Please refer to this tutorial:[^]
Sandeep Mewara 20-Jul-12 16:09pm
My 5!
Shaunak De 21-Jul-12 1:16am
Thanks :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900