Jump to content

Printing off a certain area


graham23s

Recommended Posts

Hi Guys,

 

on our ecommerce site we display the data coming from the completed orders table like:

 

<?php
  case "view-test-order-details":
  
   // Grab the hidden var
   $order_id = (int)$_POST['hid_id'];
   
   
   // grab everthing asscociated with the id
   $q_order = "SELECT * FROM `fcp_orders_completed` WHERE `ID`='$order_id'";
   $r_order = mysql_query($q_order);
   $a_order = mysql_fetch_array($r_order);
   $order_invoice_id = $a_order['ID'];
   $order_wp_id = $a_order['WP_CART_ID'];
   
   // print out invoice page
   print("<table class=\"tbl_invoice\" width=\"700\" cellpadding=\"5\" cellspacing=\"0\">");
   print("<tr>");
   print("<td align=\"left\" valign=\"top\" ><h1>INVOICE FCP IMAGE HERE!</h1></td><td align=\"right\">Razwan Shafi<br />Carmmunock Pharmacy<br />17 Busby Road<br />Glasgow<br />United Kingdom<br />Tel: 0141 644 1765</td>");
   print("</tr>");
   print("<tr>");
   print("<td align=\"center\" colspan=\"2\"><hr /></td>");
   print("</tr>");
   print("<tr>");
   print("<td align=\"left\">Invoice ID:</td><td align=\"right\"><b>$order_invoice_id</b></td>");
   print("</tr>");
   print("<tr>");
   print("<td align=\"left\">Transaction ID:</td><td align=\"right\"><b>$order_wp_id</b></td>");
   print("</tr>");
   print("<tr>");
   print("<td align=\"center\" colspan=\"2\"><hr /></td>");
   print("</tr>");
   print("<tr>");
   print("<td align=\"center\" colspan=\"2\"><input type=\"submit\" name=\"print_invoice\" value=\"Print Invoice\"></td>");
   print("</tr>");
   print("</table>");
  
  break;
?>

 

im wondering how we would go about pressing the print button and only the invoice is printed off!

 

any help would be great

 

cheers

 

Graham

Link to comment
https://forums.phpfreaks.com/topic/117752-printing-off-a-certain-area/
Share on other sites

I would use CSS to accomplish this.

 

Wrap the code you don't want printing in a div and give it an ID, create a css file and place the id in there with a display:none.

 

Call the CSS file as media="print" and it will only be applied to printed pages.

 

That is how I have accomplished these things previously.

 

 

Nate

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.