I am working on a form in php mysql. therefore, on my page there is a form below that I showed the data of this form in table format. Now I want to print only the table structure, so I just made the PRINT button like:
<span style="float:right;"><a href="javascript:window.print()" type="button" class="btn">PRINT</a></span>
but it will print the whole page with the form field and table, and I just want the table to print. Here is the design of my entire page with a form and a table:
<html> <head></head> <body> <div class="container"> <form class="form-horizontal" action="" method="post" name="userform1" id="company-form" enctype="multipart/form-data"> <?php if($_GET[id]){?> <fieldset> <legend>Add Company</legend> <div class="control-group"> <label class="control-label">Company Name</label> <div class="controls"> <input type="text" name="company" id="company" value="<?php echo $selup['company']?>"> </div> </div> <div class="control-group">another field</div> <div class="control-group">another field</div> <div class="control-group"> <div class="controls"> <button type="submit" class="btn" name="submit" id="submit" value="Submit">Submit</button> </div> </div> <table class="table table-bordered"> <tbody> <tr> <td>S.No.</td> <td>Company Name</td> <td>Type</td> <td>Action</td> </tr> <?php <tr> <td><?php echo $value[id];?></td> <td><?php echo $value[company ];?></td> <td><?php echo $value[type];?></td> <?php ?> <td><a href="<?php echo $_SERVER['PHP_SELF']; ?>?id=<?php echo $value[id];?>&cmd=edit"><i class="icon-edit"></i></a> <a href="<?php echo $_SERVER['PHP_SELF']; ?>?id=<?php echo $value[id];?>&cmd=delete" onclick="return confirm('Are you sure you want to delete <?php echo $value[customer];?>?')"><i class="icon-trash"></i></a></td> </tr><?php }?> </tbody> </table> </fieldset> <form> </div> </body>
so I just want to print a spreadsheet not a whole page.
source share