Вопрос

This may be asked in multiple forums but I just can't get it working.

I have php to get records from the database and output in table format.

my sample code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body vspace="0" hspace="0" onload="window.print();">
<Table width="100%" border="1" cellpadding="0" cellspacing="0" align="center" vspace="0">
<thead>
   <tr style=\"background-color:#D8D8D8;color:#000000;font-weight:bold;height:50px;\">
     <td width=\"100\" align=\"center\">Date</td>
     <td width=\"80\" align=\"center\">Adult</td>
     <td width=\"80\" align=\"center\">Child</td>
     <td width=\"80\" align=\"center\">Total</td>
     <td width=\"450\" align=\"center\" colspan=\"2\">Remark</td>
   <tr>
</thead>
<tbody>

  <?php loop scripts 
    <TR>
   // need to have a page break here if record rows is 23 
   // the number records that can fit in a page is 
   // 21 rows per page (laserjet printer selected)
   // 23 rows per page (pdf printer selected) i prefer pdf printer
    </tr>
  ?>
</tbody>
<tfoot>
  <?php "<tr><td>".calculation and displays sum of Adult, sum of Child and sum of Total."</td></tr>" ?>
</tfoot>
</table>
</body>
</html>

my issue is that i have used "page-break-before:always" in another page with table format and it works. That is table within table (new table for each record with sql join statement). I have whatever solution i can possibly find on the net to do this page break but to no avail. my next issue is using table header which doesn't work at all. It supposedly repeat the onto the next page but it doesn't.

what am i missing here?

Это было полезно?

Решение

Have you tried this:

{
h1 {page-break-before:always}
}

And use H1 after every 23 rows?

<td><h1>Here we start new page</h1></td>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top