MrTV
asked on
page breake separate page php css
All 4 page are the same code but when i try to prinpreview with fire fox it not separate into 4 page
How can i make it separate when print
Page1.php,Page2.php,Page3. php Page4.php are the same code
How can i make it separate when print
Page1.php,Page2.php,Page3.
[Main.php]
<?php
require_once('../Connections/localhost.php');
mysql_select_db($database_localhost, $localhost);
$maxRows_Recordset1 = 5;
$pageNum_Recordset1 = 0;
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style2 {
font-size: 14px;
font-weight: bold;
}
.style3 {color: #000000; font-size: 9px; }
div.page { page-break-aftere:always}
-->
</style>
</head>
<body>
<div class="page"><?php include "Page1.php"; ?></div>
<div class="page"><?php include "Page2.php"; ?></div>
<div class="page"><?php include "Page3.php"; ?></div>
<div class="page"><?php include "Page4.php"; ?></div>
</body>
</html>
[Page1.php]
<?php
$query_Recordset1 = "SELECT * FROM billingdetail WHERE BilDetRef = 29 ORDER BY id ASC ";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $localhost) or die(mysql_error());
$rows_Recordset2 = mysql_num_rows($Recordset1); //get the number of rows returned here
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$my_counter = 0; // count records read
?>
<table width="699" border="0">
<tr>
<td colspan="2"> <div align="center"><span class="style2">ใบกำกับภาษี TAX INVOICE </span> <em>ต้นฉบับลูกค้า</em></div></td>
</tr>
<tr>
<td width="456" class="style3"><span class="style2">บริษัท สมุย เคเบิ้ล ทีวี จำกัด</span></td>
<td width="233" class="style2"><span class="style3">เลขประจำตัวผู้เสียภาษีอากร 3 821 018544 </span></td>
</tr>
<tr>
<td class="style3">45/1-2 หมู่ 1 ตำบลแม่น้ำ อำเภอเกาะสมุย จังหวัดสุราษฎร์ธานีโทร.(077) 425004-5 Fax ต่อ 18 </td>
<td class="style2">เลขที่</td>
</tr>
<tr>
<td class="style3">นาม Name/ที่อยู่ Address</td>
<td class="style2">วันที่</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table>
<table width="692" border="0">
<tr>
<td width="10">unitit</td>
<td><div align="center">Description</div></td>
<td width="70">unit/price</td>
<td width="70">total</td>
</tr>
<?php
do { $my_counter++; // number of recors processed
$my_BilDetQua = $row_Recordset1['BilDetQua'];
$my_BilDetProName = $row_Recordset1['BilDetProName'];
$my_BiDelPrice = $row_Recordset1['BiDelPrice'];
$my_total = $my_BilDetQua * $my_BiDelPrice
?>
<tr>
<td><?php echo $my_BilDetQua; ?></td>
<td><?php echo $my_BilDetProName; ?></td>
<td><?php echo $my_BiDelPrice; ?></td>
<td><?php echo $my_total; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
echo "no of records initial $rows_Recordset2 / in the loop $my_counter<br>";
if($rows_Recordset2 < 5 ){
$counter = 5 - $rows_Recordset2; //get the times you want a particular row to be repeated
echo " counter = ".$counter;
for($rowct = 1; $rowct < $counter; $rowct++){
echo "
<tr>
<td> <?=$rowct?></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<? php // NOTE: THIS IS MISSING IN ALL CODES POSTED ";
} // end of for loop here
} //end of if loop here
?>
<tr>
<td colspan="3">remark</td>
<td> </td>
</tr>
<tr>
<td colspan="2" class="style2"> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="3"> </td>
<td> </td>
</tr>
</table>
<?php mysql_free_result($Recordset1); ?>
rows.GIF
The browser does not know that you are using X number of files. The browser just sees ALL the html code you send it, so it does not differentiate between files. To the browser it is a SINGLE "file".
ASKER
hi hielo
I wan to make a invoice with the same for 4 copy , for me ,for customer,for goverment (it a little bit different in title of each )
I want to print it with browser and I want when print it separate into 4 pages
I wan to make a invoice with the same for 4 copy , for me ,for customer,for goverment (it a little bit different in title of each )
I want to print it with browser and I want when print it separate into 4 pages
If I understand you correctly, you want to "push" the pages so that they are printed on separate pages. If so, then try the code below. If the page don't quite start at the top of the page, adjust the line-height within the @media print section for the respective breaker div until it is positioned where you want it.
<?php
require_once('../Connections/localhost.php');
mysql_select_db($database_localhost, $localhost);
$maxRows_Recordset1 = 5;
$pageNum_Recordset1 = 0;
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
@media screen{
{
#breaker1,#breaker2,#breaker3{display:none;}
.style2 {
font-size: 14px;
font-weight: bold;
}
.style3 {color: #000000; font-size: 9px; }
div.page { page-break-aftere:always}
}
@media print{
#breaker1,#breaker2,#breaker3{display:block;}
#breaker1{
line-height:15em;
}
#breaker2{
line-height:15em;
}
#breaker3{
line-height:15em;
}
}
</style>
</head>
<body>
<body>
<div class="page"><?php include "Page1.php"; ?></div>
<div id="breaker1"> </div>
<div class="page"><?php include "Page2.php"; ?></div>
<div id="breaker2"> </div>
<div class="page"><?php include "Page3.php"; ?></div>
<div id="breaker3"> </div>
<div class="page"><?php include "Page4.php"; ?></div>
</body>
</body>
</html>
ASKER
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.