
I have a small problem. The attached code I have should print a page of sata and insert a page break so the output does not run on from one sheet to another. IE - If I have account information on the page and each account is seperated by a horizontal line the data from the last account should note start on one page and finsh on another. The problem is when the page breaks I loose the account info from the page directly after the break. Can someone please let me know what I'm doing wrong?
My Code as of now...
<?php
ob_start();
session_start();
?>
<html>
<head>
<title>Printer Friendly</title>
<?php
//this will include the meta.php file. It has the meta tags
include ('meta.php');
//this will check if the user has logged in. if not it will send them to the login.php page
if ($_SESSION['login'] == "") {
header('location: login.php');
}
?>
</head>
<body onLoad="history.go(+1)">
<form name="print" action="print.php" method="POST">
<p align="left">
<input type="submit" name="back" value="Go to the accounts in progress page">
<input type="submit" name="cancel" value="Cancel This Request">
</p>
</form>
<p align="center">
<input type="button" value="Print This List" name="PrintBtn" onClick="window.print()" style="float: left">
</p>
<p align="center"> </p>
<hr>
<blockquote>
<blockquote>
<blockquote>
<p align="center"><font color="#FFFFFF" size="4">
<span style="background-color: #FF0000; font-weight:700; font-style:italic">PLEASE NOTE - IF YOU WOULD LIKE TO PRINT
THIS PAGE PLEASE PRINT IT FIRST BEFORE MOVING TO THE "IN PROGRESS" QUEUE</span></font></p>
</blockquote>
</blockquote>
</blockquote>
<h3 align="center"><i><font color="#FF0000">
<span style="background-color: #FFFFFF"><font size="3">These account have now been flagged as "in progress"</font></span><b><span style="background-color: #FFFFFF"><font size="3"> Pressing "back" on your browser will not cancel this request. Please use the Cancel button
above. If you press "back" you can still cancel this request by moving all accounts back to the queue from the "accounts in progress" page.</font></span></b></font></i></h3>
<hr>
<?php
//this is setting the session created when the user logged in to a variable name called session. this will hold their name, to number etc etc
$session = ($_SESSION['login']);
include('mysqlconnect.php');
Include('mysqltable_data.php');
$sql_query = "select * from cmu_data where printing = '" . $session['tonumber'] . "' and queue = 'printing'";
$query_run = mysql_query($sql_query);
$break = 0;
$second_break = 13;
while ($query_res = mysql_fetch_array($query_run)) {
if ($break == 5) {
print "<br><br><br>";
$break++;
} elseif ($break == $second_break) {
print "<br><br><br><br><br>";
$second_break = ($second_break + 7);
} else {
print "<b>Account Number: " . $query_res['Account_Number'] . "</b><br>";
print "Bank Account Number: " . $query_res['Cust_Bank_Account'] . "<br>";
print "Debit Amount: $" . $query_res['Debit_Amount'] . "<br>";
print "PAP Change: " . $query_res['Change_PAP'] . "<br>";
print "Extension Payment: " . $query_res['Extension_Payment'] . "<br>";
print "<b>Special Instructions: " . $query_res['Special_Instructions'] . "</b><br>";
print "<hr>";
$break++;
}
}
mysql_close();
//if the user presses the back butten then go back to the cmureport.php page
if (isset($_POST['back'])) {
header("location: inprogress.php");
}
if (isset($_POST['cancel'])) {
include('mysqlconnect.php');
mysql_select_db('cmutest1');
$sql_query = "update cmu_data set printing = '', queue = '' where printing = '" . $session['tonumber'] . "' and queue = 'printing'";
$query_run = mysql_query($sql_query);
mysql_close();
header("location: cmureport_cmu.php");
}
?>
</body>
</html>