title: How to print only html contain in php code like printing receipt
body: <p>I want to print my table data <code>onclick</code>.
  I use the following JavaScript code: </p>
  
  <pre><code>&lt;input type="button" name="print" id="print" value="Print" onclick="myFunction()"/&gt;
  
  &lt;script&gt;
  myFunction()
  {
  window.print();
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>But the code prints the entire web page.<br>
  I want to print only my table like printing a receipt how to do it?</p>