Home » HTML, PHP9 December 2007

Creating dynamic HTML table in PHP : Easy and Simple tutorial

Problem:

I want to create a dynamic HTML table with a row starting after certain number of columns, i.e. like, i want to create an html table which automatically generate new row after 3 columns in a row.

Solution:

Here, $content is an array of 9 numbers (1 to 9). The array value can be any. You can have your custom array with your custom values. I have looped through the array and printed data in a html table. I have created new row after 3 columns have been created.

Hope it helps.
Thanks.

PHP

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • Yrollgayanth

    Thanks a lot, this is very useful

  • Stergios

    Actually does not work very well for all cases. Need to create empty rows .
    Test your code for 4 columns