Advertisement
sparkweb

Multiple Receipt Templates

Sep 22nd, 2011
711
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.82 KB | None | 0 0
  1. <?php
  2. //Place This code right after the <body> tag
  3. //Make sure that .noprint { display: none; } is in your @media print css
  4. //Now you can go through your template and do if-then statements for the $receiptstyle variable
  5.  
  6. $current_url = "";
  7. foreach($_GET as $key => $val) {
  8.     if ($key == "receiptstyle") continue;
  9.     if ($current_url) $current_url .= "&amp;";
  10.     $current_url .= $key."=".urlencode($val);
  11. }
  12. $current_url = "edit.php?".$current_url;
  13.  
  14. $receiptstyle = isset($_GET['receiptstyle']) ? (int)$_GET['receiptstyle'] : 1;
  15. ?>
  16. <ul class="noprint">
  17.     <li><a href="<?php echo $current_url . "&amp;receiptstyle=1"; ?>">Standard Recipt</a></li>
  18.     <li><a href="<?php echo $current_url . "&amp;receiptstyle=2"; ?>">Gift Recipt</a></li>
  19.     <li><a href="<?php echo $current_url . "&amp;receiptstyle=3"; ?>">Pick List</a></li>
  20. </ul>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement