html - Dynamic Table Layout using PHP Logic -


I have a simple table that has around 80 rows, which I'm dynamically using PHP. What I'm trying to do, is to place those lines in those lines for each row. So if I have 80 rows, then I have to do 4 columns of 20 rows or so, maybe there should be more or less depending on the total number of rows in the last column. The total number of rows can change!

I'm having trouble with an implementation method which will not be messy! Nobody knows in a simple way that I can apply it.

I have tried to use a counter, as I have looped the data to populate the table and when one of 20 is delivered to the next block, but for me Did not because I had extra lines

  foreach ($ index index as index) {$ counter ++; Echo '& lt; Tr & gt; '; If ($ counter> 20) {$ multiplier = $ counter / 20; $ Head = '& lt; Td> & Lt; / Td> '; ($ I = 1; $ i  & lt; td & gt; & lt; Input ID = '$ index' name = '$ index' type = 'checkbox' / >  

Thanks for any help

>

I do:

  $ nbCols = 4; $ NbRows = count ($ index) / $ nbCols; ($ Line = 0; $ line & lt; $ nbRows; $ line ++) {resonant "& lt; Tr ($ i = 0; $ i & lt; $ nb calls; $ i ++) {$ index = $ index [$ line + ($ i $ $ nbRows)]; Encoded " & Lt; Td> $ Index & lt; / Td> & Lt; Td> & Lt; Input id = '$ index' name = '$ index' type = 'checkbox' / & gt; & Lt; / Td> ";} resonates" & lt; / Tr & gt; ";}  

Comments