0

The following code prints to the bluetooth printer via the sendToQuickPrinter function perfectly, but the page does not run the PHP script below it. When the printer completes printing, I need the page to execute the php script to call a different page. Thanks

<script>
function sendToQuickPrinter(){
var text =
"<CENTER><MEDIUM2><?php echo $shop_name ?><BR>" +
"<CENTER><?php echo $display_date ?>        <?php echo $display_time ? 
<BR><BR>" +
"Description          Price<BR>" +
"<?php $i=0;while($i < $print_count){$i=$i+1; echo 
$p_name_array[$i].';; ;;'.$transaction_qty_array[$i].' @ 
'.number_format($p_price_array[$i],2).'<BR>';} ?>" +
"<BR>" +
"<CENTER>Sub-total      $<?php echo number_format($subtotal,2) ?><BR>" 
+
"<CENTER>Tax            $<?php echo number_format($subtax,2) ?><BR>" +
"<CENTER>Total          $<?php echo number_format($item_total,2) ?> 
<BR>" +
"<BR>" +
"<CENTER>Thank you for shopping with us, we appreciate your business! 
<BR>" +
"<CENTER><MEDIUM2> Have a great day!<BR>" +
"<BR>" +
"<CUT>" +
"DRAWER";
var textEncoded = encodeURI(text);
window.location.href="quickprinter://"+textEncoded;
}
sendToQuickPrinter();
</script>

<?php
$path = "cart.php";

function success_return($path, $shop_name, $longitude, $latitude) {  
    include($path);
}  

success_return($path, $shop_name, $longitude, $latitude);
exit;
?>
Ricky T
  • 243
  • 1
  • 13
  • 1
    the php is all over, before the browser even sees the js. –  Apr 22 '19 at 23:17
  • Possible duplicate of [What is the difference between client-side and server-side programming?](https://stackoverflow.com/questions/13840429/what-is-the-difference-between-client-side-and-server-side-programming) – miken32 Apr 22 '19 at 23:44

0 Answers0