Print dynamic query

0

I have a query on a system where the user selects the month and the corresponding records are shown on the same page. I want to print the result of the query but as the form sends via GET:

<form action="" method="get" id='form-contato' class="form-horizontal col-md-10"> 

I can not send to another page and mount the pdf to print. Is there a way to send the query result to an Array and call the file "print.php"?

Remembering that this query changes with each choice of a new month.

    
asked by anonymous 21.08.2017 / 11:31

1 answer

0

You can use CSS to determine the areas you want to print, and create a button, which when called, calls the print method.

See the example below.

$("#print_page").on("click", function(){
  window.print();
});
<!DOCTYPE html>
<html>
<head>
  <title>Imprimir área desejada</title>
  <style type="text/css">
    @media print {
      * {
        visibility:hidden;
      }
      .imprimir {
        visibility: visible;
        position: absolute;
        top:0;
        left:0;                                     
      }                                  
    }
  </style>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script></head><body><strong>Istonãovaiserimpresso!</strong><divclass="imprimir">
      Já isto e, apenas isto, será impresso!
      <input type="button" id="print_page" value="IMPRIMIR" />
  </div> 
  Aqui também não vai sair na impressão!            
</body>
</html>
    
21.08.2017 / 12:50