I want to physically print specific data in a PHP form to local printer, this form is part of CRUD PHP project running on localhost
.
All solutions that I have seen use window.print();
which leads to a print of the full page, instead of only the data in the form as I need.
My code:
<form method="POST" action="">
<div class="form-group">
<input type="number" name="stu_num" class="form-control" value = "<?php echo $stu_num ; ?>">
</div>
<div class="form-group">
<label >Student Name</label>
<input type="text" name="stu_name" class="form-control" value = "<?php echo $stu_name ; ?>" >
</div>
<div class="form-group">
<input type="number" name="no_pouch" class="form-control" >
</div>
<div class="form-group">
<input type="number" name="no_contra" class="form-control" >
</div>
<div class="form-group">
<label>Date</label>
<input type="text" name="date" class="form-control" value = "<?php echo $date ; ?>">
</div>
<button name="print" class="btn btn-primary">Print</button>
</form>