keymasterviriya1150

Untitled

May 5th, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.27 KB | None | 0 0
  1. <script>
  2.     function printDiv(divName) {
  3.         var printContents = document.getElementById(divName).innerHTML;
  4.         var originalContents = document.body.innerHTML;
  5.  
  6.         document.body.innerHTML = printContents;
  7.         window.print();
  8.  
  9.         document.body.innerHTML = originalContents;
  10.     }
  11. </script>
  12. <?php
  13. require_once('config.php');
  14. ob_start();
  15. ?>
  16.  
  17. <?Php
  18.  
  19. $content = ob_get_clean();
  20. require_once'/mpdf1/mpdf.php';
  21. $pdf = new mPDF('P', 'A4', 'fr', 'UTF');
  22. $pdf->writeHTML($content);
  23.  
  24.  
  25. ?>
  26. <div id='report'>
  27. <?php
  28.     $con=mysqli_connect("localhost","root","","testorder");
  29.     /*if($con!=null)
  30.         echo"Sucess";*/
  31.     $result=mysqli_query($con,"SELECT * FROM list WHERE IDTYPE>0 " );
  32.     if(!$result)
  33.         die("connot");
  34.     $data=array("ID","IDType","Type","Price");
  35.     echo"<center>";
  36.     echo"<h1><u>Report</u></h1>";
  37.     echo"<table border=1>";
  38.         echo"<tr>";
  39.             for($i=0; $i<count($data) ; $i++)
  40.                 echo"<td>".$data[$i]."</td>";  
  41.     echo"</tr>";   
  42.     while($row=mysqli_fetch_array($result,MYSQLI_NUM))
  43.     {
  44.         echo"<tr>";
  45.         for($i =0; $i<4 ;$i++)
  46.             echo "<td>".$row[$i]."</td>";  
  47.         echo"<tr>";
  48.     }
  49.    
  50. echo"</table>";
  51. echo"</center>";
  52.  
  53.  
  54.  
  55. ?>
  56. </div>
  57.  <center><input type='button' value='PrintReport' onclick='printDiv("report")'></center>
Advertisement
Add Comment
Please, Sign In to add comment