Hi
I have some tables generated from php code where there's a bunch of tables on a page. Each table could be a different height depending on user input. And there could be any number of tables.
I want to stop a table splitting into two and putting the last half on the next page when it's printed. Is there a way to do this using css?
I was thinking something like
*get the print area available somehow
* work out each table's table height
* keep adding the table heights until the total exceeds the available print height available
* tell it to print all tables on that page except the last one
* repeat the above for subsequent pages
I don't know if any of this is possible, or even if there's a much easier way.
Can anyone help this css newbie? In case it helps, the table-generating code is below
I have some tables generated from php code where there's a bunch of tables on a page. Each table could be a different height depending on user input. And there could be any number of tables.
I want to stop a table splitting into two and putting the last half on the next page when it's printed. Is there a way to do this using css?
I was thinking something like
*get the print area available somehow
* work out each table's table height
* keep adding the table heights until the total exceeds the available print height available
* tell it to print all tables on that page except the last one
* repeat the above for subsequent pages
I don't know if any of this is possible, or even if there's a much easier way.
Can anyone help this css newbie? In case it helps, the table-generating code is below
Code:
$i=0; while ($i < $num) { $entry=mysql_result($result,$i,"entry"); $date=mysql_result($result,$i,"date"); $comps=mysql_result($result,$i,"comps"); $workplace=mysql_result($result,$i,"workplace"); $id=mysql_result($result,$i,"id"); $c=explode(',',$comps); $count=count($c); echo "<br><table width=600><tr><td><b>Written on ".$date." [Workplace: ".ucfirst($workplace)."]</b><br><ul>"; for($k=0; $k<mysql_num_fields($resultinfo); $k++) { $fieldname = mysql_fetch_field($resultinfo, $k); $var=$fieldname->name; foreach($c as $values) { if(mysql_result($resultinfo,0,$var)==$values && $values!="") { echo "<li>".strtoupper($values)." (".mysql_result($resultinfo,0,str_replace('short','name',$var)).")</li>"; } } } echo "</ul>".nl2br($entry)."</td></tr></table>"; $i++; }