Create table using for loop in PHP

Here, at phptpoint we begin from the scratch where we can lead you on the practice of these languages.

sanjeev kumar
1 min readFeb 15, 2022

This is a free and online site where the students who want to build a career in the same profession, can be trained about the working of the PHP.

Perhaps you can go to any of the Php Tutorial where you have to spend a hefty amount also and apart from that you need to give time as well. But here at Phptpoint, we provide functional and easy to understand PHP tutorials for beginners with examples.

Apart from free online tutorial Phptpoint provides you free downloading facility also. Students can easily download free php projects.

Create table using for loop in PHP

<?phpif(isset($_POST['create'])){$rows=$_POST['r'];$cols=$_POST['c'];echo "<table border='1'>";for($i=0;$i<$rows;$i++){echo "<tr>";for($j=0;$j<$cols;$j++){echo "<th>"."r".$i."c".$j."</th>";}echo "</tr>";}echo "</table>";}?><html><body><form method="post"><table width="400" border="1"><tr><td width="177">Enter number of rows </td><td width="207"><input type="text" name="r"/></td></tr><tr><td>Enter number of column </td><td><input type="text" name="c"/></td></tr><tr><td colspan="2"><input type="submit" value="Create Table" name="create"/></td></tr></table></form></body></html>r0c0r0c1r0c2r1c0r1c1r1c2r2c0r2c1r2c2Enter number of rowsEnter number of column

--

--