Printing in javascript and php

I am trying to print everything between div tags but can only print 1 page and if there is more than one page worth of data in it it gets left out. How do I insert page breaks inside the php code or something that I would to print to multiple pages?

javascript Code
function printDiv(divID) {

            • //Get the HTML of div
            • var divElements = document.getElementById(divID).innerHTML;
            • //Get the HTML of whole page
            • var oldPage = document.body.innerHTML;
            • //Reset the page’s HTML with div’s HTML only
            • document.body.innerHTML =*
              • “<html><head><title></title></head><body>” +*
              • divElements + “</body>”;
            • //Print Page
            • window.print();
            • //Restore orignal HTML
            • document.body.innerHTML = oldPage;

        • }
          End of Javascript

	while($prow = mysql_fetch_array($PrintSql))
echo '<tr><td>';
echo '<table width="100%" border="1">';
echo '<tr><th align="right" width="20%" height="20px">Stage</th><td>' . $prow['Stage']. '</td></tr>';
echo '<tr><th align="right" height="20px">State</th><td>' . $prow['StateName']. '</td></tr>';
echo '<tr><th align="right" height="20px">City</th><td>' . $prow['CityName']. '</td></tr>';
echo '<tr><th align="right" height="20px">Hospital Name</th><td>' . $prow['HospitalName']. '</td></tr>';
echo '<tr><th align="right" height="20px">Casualty/Trauma</th><td>' . $prow['HospitalCasualty']. '</td></tr>';
echo '<tr><th align="right" height="20px">Address</th><td>' . $prow['Address']. '</td></tr>';
echo '<tr><th align="right" height="20px">Contact Person</th><td>' . $prow['ContactPerson']. '</td></tr>';
echo '<tr><th align="right" height="20px">Contact Number</th><td>' . $prow['ContactNum']. '</td></tr>';
echo '<tr><th align="right" height="20px">Emergency Number</th><td>' . $prow['EmergencyNum']. '</td></tr>';
echo '<tr><th align="right" height="20px">Number Of Beds</th><td>' . $prow['NumBeds']. '</td></tr>';
echo '<tr><th align="right" height="20px">Facilities</th><td>' . $prow['Facilities']. '</td></tr>';
echo '<tr><th align="right" height="20px">Distance to CBD</th><td>' . $prow['DistanceCBD']. '</td></tr>';
echo '<tr><th align="right" height="20px">Helipad</th><td>' . $prow['YesNo']. '</td></tr>';
echo '<tr><th align="right" height="20px">GPS</th><td>' . $prow['GPS']. '</td></tr>';
echo '</table>';
echo '</td></tr>';
echo '<tr><td height="20px" colspan="2"></td></tr>';



When printing a table the <thead> is supposed to print at the top of every page, the <tfoot> at the bottom of every page and the <tbody>s following those sections will then fill the area in between taking as many pages as required. Older browsers don’t support this properly but that’s how it is supposed to work. You haven’t included any of these in your table so most browsers will assume that the entire content of the table is in a single <tbody> which may not give you the result you want.

Trying to print tables across multiple pages in older browsers doesn’t always work as expected even when the table is coded properly.

None of this has anything to do with either JavaScript or PHP - it is an HTML issue.