title: How to print some specific part of a page via window.print()
body: <p>i'm working on a form in php mysql. so in my page there is a form and below that i shown the data of that form in table format.now i want to print only the table structure thats why i just made a PRINT button as:</p>
  
  <pre><code>&lt;span style="float:right;"&gt;&lt;a href="javascript:window.print()" type="button" class="btn"&gt;PRINT&lt;/a&gt;&lt;/span&gt;
  </code></pre>
  
  <p>but it will print the whole page with form field and table and i just want the tableto print.
  Here is the design of my whole page with form and table:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;&lt;/head&gt;
  &lt;body&gt;
   &lt;div class="container"&gt;
   &lt;form class="form-horizontal" action="" method="post" name="userform1" id="company-form" enctype="multipart/form-data"&gt;
       &lt;?php if($_GET[id]){?&gt;
  
  
  &lt;fieldset&gt;
       &lt;legend&gt;Add Company&lt;/legend&gt;
      &lt;div class="control-group"&gt;
      &lt;label class="control-label"&gt;Company Name&lt;/label&gt;
      &lt;div class="controls"&gt;
      &lt;input type="text" name="company" id="company" value="&lt;?php echo $selup['company']?&gt;"&gt;
      &lt;/div&gt;
      &lt;/div&gt;
  &lt;div class="control-group"&gt;another field&lt;/div&gt;
  &lt;div class="control-group"&gt;another field&lt;/div&gt;
  &lt;div class="control-group"&gt;
      &lt;div class="controls"&gt;
      &lt;button type="submit" class="btn" name="submit" id="submit" value="Submit"&gt;Submit&lt;/button&gt;
      &lt;/div&gt;
      &lt;/div&gt;
  &lt;table class="table table-bordered"&gt;
             &lt;tbody&gt;
              &lt;tr&gt;
                  &lt;td&gt;S.No.&lt;/td&gt;
                  &lt;td&gt;Company Name&lt;/td&gt;
                  &lt;td&gt;Type&lt;/td&gt;
                  &lt;td&gt;Action&lt;/td&gt;
            &lt;/tr&gt;
                   &lt;?php 
                   // to print the records
                  $select = "select * from company where type='Miscellaneous'";
                  $query1 = mysql_query($select);  
                   while($value = mysql_fetch_array($query1)){ ?&gt;
  
                  &lt;tr&gt;
                  &lt;td&gt;&lt;?php echo $value[id];?&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;?php echo $value[company ];?&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;?php echo $value[type];?&gt;&lt;/td&gt;
                  &lt;!--&lt;td&gt;&amp;nbsp;&lt;/td&gt;--&gt;
                  &lt;?php /*?&gt;&lt;td&gt;&lt;?php echo $value[amount];?&gt;&lt;/td&gt;               
                  &lt;td&gt;&lt;?php echo $value[date];?&gt;&lt;/td&gt;&lt;?php */?&gt;
                  &lt;td&gt;&lt;a href="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;?id=&lt;?php echo $value[id];?&gt;&amp;cmd=edit"&gt;&lt;i class="icon-edit"&gt;&lt;/i&gt;&lt;/a&gt;
                 &lt;a href="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;?id=&lt;?php  echo $value[id];?&gt;&amp;cmd=delete" onclick="return confirm('Are you sure you want to delete &lt;?php  echo $value[customer];?&gt;?')"&gt;&lt;i class="icon-trash"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/td&gt;
  
  
                  &lt;/tr&gt;&lt;?php }?&gt;
          &lt;/tbody&gt;
         &lt;/table&gt;
  &lt;/fieldset&gt;
  &lt;form&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>so i just want to print the table not whole page.</p>