On Sat, 2008-12-13 at 10:18 +0200, Osman Osman wrote: > Hello, > I'm looking for a library in PHP that will let me easily create tables > programmatically. It would be great if I can just specify information about > the rows/columns, what each cell should contain, etc, and the table would > get created automatically. I should be able to do anything I would be able > to do with normal HTML tables. Is there anything like that available? > > Thanks, > Osman $arr = array(array('celldata row 1, col1', 'celldata row 1, col2'), array('celldata row 2, col1', 'celldata row 2, col2')); <table> <tr> <th>heading1</th> <th>heading2</th> </tr> <?php foreach ($arr as &$row): ?> <tr> <?php foreach ($row as &$col): ?> <td><?php echo $col ?></td> <?php endforeach ?> </td> <?php endforeach ?> </table> Do you really need a library for that? I had thought about this too but couln't come up with a good solution to do this generically and being as flexible as this. All you have to do is copy/paste the html code and put some php inbetween if you have a designed table with css and all that jazz. Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php