Hi,
Did you try window.print() (javascript) ?
You can redirect page with javascript itself.
Check this link for more details:
http://www.tizag.com/javascriptT/javascriptprint.php
Best Regards
Praveen
--- On Wed, 15/4/09, raji skariah <raji_ska@...> wrote:
From: raji skariah <raji_ska@...>
Subject: [phpKerala] Help for Printing-Bill
To: bang-phpug@yahoogroups.com, php4india@yahoogroups.com,
phpKeralaUg@yahoogroups.com
Date: Wednesday, 15 April, 2009, 4:58 PM
HI
Dear PHP Friends..., Please ..help me....
I need to enter some details in a form and when I click on the 'Save & Print'
Button, need
to print the details to a small type printer (which is usually used in shops for
billing)
ie, A bill to the customer. and then again back to the billing data entry
screen.
I just made an html form with the details from 'screen' to print from the
browsers- 'File -> Print'
But here I need to goback to the 'billing data entry' screen again with some
link.
Is there any other method to do the print from the button click from the
'billing data entry
screen' itself? without redirecting?
If so.. how? please help me..
The PHP code I made is like this..
<?php @include 'class/session. php';
include 'class/connection. php';
if(!$_SESSION[ 'ADMIN']) {
header('location: index.php');
exit;
}
ob_start();
if($_REQUEST[ 'act']==" add") {
$txt_Tokenno = $_REQUEST['txt_ Tokenno'] ;
$txtDate = $_REQUEST['txtDate' ];
$txtCustName = $_REQUEST['txtCustN ame'];
$txtCustAdd = $_REQUEST['txtCustA dd'];
$txtContactNo = $_REQUEST['txtConta ctNo'];
$txtHandsetModel = $_REQUEST['txtHands etModel'] ;
$txtHandsetIMEI = $_REQUEST['txtHands etIMEI'];
$menu1 = $_REQUEST['menu1' ];
$txtProblem = $_REQUEST['txtProbl em'];
$txtObservation = $_REQUEST['txtObser vation'];
$txt_Tokenno = htmlentities( $txt_Tokenno, ENT_QUOTES) ;
$txtCustName = htmlentities( $txtCustName, ENT_QUOTES) ;
$txtCustAdd = htmlentities( $txtCustAdd, ENT_QUOTES) ;
$txtContactNo = htmlentities( $txtContactNo, ENT_QUOTES) ;
$txtHandsetModel = htmlentities( $txtHandsetModel ,ENT_QUOTES) ;
$txtHandsetIMEI = htmlentities( $txtHandsetIMEI, ENT_QUOTES) ;
$menu1 = htmlentities( $menu1,ENT_ QUOTES);
$txtProblem = htmlentities( $txtProblem, ENT_QUOTES) ;
$txtObservation = htmlentities( $txtObservation, ENT_QUOTES) ;
list($vpath, $vpath1,$ vpath2)=split( "-",$txtDate) ;
$y_year=$vpath;
$m_month=$vpath1;
$d_day=$vpath2;
list($vpath3) =split("0000" ,$vpath2) ;
$d_day=$vpath3;
$txtDate=$vpath3. "/".$vpath1. "/".$vpath;
$insert_sql = "INSERT INTO....
.
.
.
mysql_query( $insert_sql) or die(mysql_error( ));
}
?>
<html>
<head><title> PRINT TOKEN</title>
<style type="text/css" >
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
body,td,th
{
font-family: Courier New, Courier, mono;
font-size: 14px;
}
.style2 {font-size: 14px}
.style3 {font-size: 12px}
.superscript
{
vertical-align: super;
font-size:12px;
}
.style12
{
font-size: 20px;
font-family: "Courier New", Courier, mono;
}
.style15 {font-size: 10px; font-family: "Courier New", Courier, mono; }
</style>
<meta http-equiv=" Content-Type" content="text/ html; charset=iso- 8859-1"><
/head>
<body onLoad="document. execCommand( 'SaveAs', true,'Print_ Token.html' );return
false;">
<br>
<table width="308" border=0 align="center" cellpadding= 0 cellspacing= 0
bordercolor= "#000000" >
<tr width="308"> <td align="center" class="style16" ><strong> Token Details
</strong> </td>
</tr>
<tr width="308"> <td> </td></tr>
<tr><td>
<table align="center" width="308">
<tr width="308">
<td align="left" width="98" class="style15" >Token No</td> <td
width="10">: </td><td width="200" align="left" class="style15" > <?php echo
$_POST['txt_ Tokenno'] -1; ?></td>
</tr>
<tr>
<td align="left" class="style15" >Date</td> <td>:</td><td align="left"
class="style15" > <?php echo $_POST['txtDate' ]; ?></td>
</tr>
<tr>
<td align="left" class="style15" >Customer Name</td> <td>:</td><td
align="left"
class="style15" > <?php echo $_POST['txtCustName ']; ?></td>
</tr>
<tr>
<td align="left" class="style15" >Customer Address</td> <td>:</td><td
align="left"
class="style15" > <?php echo $_POST['txtCustAdd' ]; ?></td>
</tr>
<tr>
<td align="left" class="style15" >Contact Number</td> <td>:</td><td
align="left"
class="style15" > <?php echo $_POST['txtContactN o']; ?></td>
</tr>
<tr>
<td align="left" class="style15" >Handset Model</td> <td>:</td><td
align="left"
class="style15" > <?php echo $_POST['txtHandsetM odel']; ?></td>
</tr>
<tr>
<td align="left" class="style15" >Handset IMEI/ESI</td> <td>:</td><td
align="left"
class="style15" > <?php echo $_POST['txtHandsetI MEI']; ?></td>
</tr>
<tr>
<td align="left" class="style15" >Warranty Status</td> <td>:</td><td
align="left"
class="style15" ><?php echo $_POST['menu1' ]; ?></td>
</tr>
<tr>
<td align="left" class="style15" >Problem Report</td> <td>:</td><td
align="left"
class="style15" > <?php echo $_POST['txtProblem' ]; ?></td>
</tr>
<tr><td align="left" class="style15" >Observation< /td> <td>:</td><td
align="left"
class="style15" ><?php echo $_POST['txtObservat ion']; ?></td>
</tr>
<tr width="308"> <td colspan="3"> </td> </tr>
<tr><td colspan="3" align="center" ><input type="button" name="Submit34"
value="Thank
You" class="bigButton" onClick="window. location. href='giveToken. php';return
false"></td>
</tr>
</table>
</td></tr>
</table></body> </html>
Thanks in advance.....
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]