MemphiS Posted December 20, 2007 Share Posted December 20, 2007 What i wish to do is have a picture of a map in the background with a grid on top like the html example below. <code> <table cellpadding=2 cellspacing=0 border=0 width=500> <tr><td background=myimage.gif> <table cellpadding=0 cellspacing=0 border=0> ?????? </table> </td></tr> </table> </code> I need to fill a grid in the ?????? section. Ive tried for(); but that isnt working as every 20 rows i need to add the <tr></tr> for a new line it also needs to be 30 rows long... Thanks for your help./ Quote Link to comment https://forums.phpfreaks.com/topic/82497-creating-a-html-grid-using-php/ Share on other sites More sharing options...
adam291086 Posted December 20, 2007 Share Posted December 20, 2007 This might help <?php $numinrow = 7; for( $counter = 1; $counter <= $numdaysinmonth; $counter ++ ) { if (in_array($counter,$arrDays)) { for ($i=$counter;$i<=$counter;$i++) { $event = implode("<P>",$arrEvent[$i]); echo "<td><a href=#>$counter<span>$event</span></td></a>"; $rowcounter ++; } } else { echo "<td>$counter</td>"; $rowcounter ++; } if($rowcounter == $numinrow) { echo "\t</tr>\n"; } } that is for a calendar. While counter is less the seven print a new column. When counter is over 7 start a new row if( $counter < $numdaysinmonth ) { echo "\t<tr>\n"; $rowcounter = 0; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/82497-creating-a-html-grid-using-php/#findComment-419370 Share on other sites More sharing options...
littledragon Posted December 20, 2007 Share Posted December 20, 2007 memphis - what's this for() statement you tried? Why can't you use a counter variable that increments on every pass, and an if statement that inserts </tr><tr> on the 20th pass? Quote Link to comment https://forums.phpfreaks.com/topic/82497-creating-a-html-grid-using-php/#findComment-419372 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.