I need to download PDF files simultaneously by selecting textboxes and clicking on a Download button. For now, I am able to click the Download button next to each item to download the item. I need to have another button which will be used for bulk download of the files.
Below is the code for the Download button next to each item.
<td><a href="print_voucher.php?em_id=<?php echo $row['voucher_id'] ?>" download="print_voucher.php?em_id=<?php echo $row['voucher_id'] ?>"> Download </a></td>
Below is the code for the whole table displaying the items to download.
<form action="createzip.php" method="post">
<table id="selection_table" class="data-table table stripe hover nowrap">
<thead>
<tr>
<div class="col-md-6">
</div>
<div class="col-md-1">
</div>
<div class="col-md-2">
</div>
<div class="col-md-3 pd-10 text-center">
<a class="btn btn-primary" name="createzip" id="createzip" value="createzip"> DOWNLOAD ALL </a>
</div>
</tr>
<tr>
<th class="table-plus datatable-nosort"> <input id="select_all" style="max-height: 20px; max-width: 20px;" type="checkbox" class="form-control" value="Select All"/> <p> Select All </p></th>
<th> COMPANY NAME </th>
<th> EMPLOYEE NAME </th>
<th> DOWNLOAD LINK </th>
</tr>
</thead>
<tbody>
<tr>
<?php
$sql = "SELECT * FROM vouchers WHERE voucher_id BETWEEN '$empID' AND '$endEmpID'";
$query = mysqli_query($conn, $sql) or die(mysqli_error());
while ($row = mysqli_fetch_array($query)) {
$id = $row['voucher_id'];
?>
<td class="table-plus">
<input style="max-height: 20px; max-width: 20px;" name="fieldid[]" id="checkbox<?php echo $row['voucher_id'] ?>" value="<?php $row['voucher_id'] ?>" type="checkbox" class="form-control">
</td>
<td><?php echo $row['paid_by']; ?></td>
<td><?php echo $row['paid_by']; ?></td>
<td><a href="print_voucher.php?em_id=<?php echo $row['voucher_id'] ?>" download="print_voucher.php?em_id=<?php echo $row['voucher_id'] ?>"> Download </a></td>
</tr>
<?php }?>
</tbody>
</table>
</form>
How to download the files simultaneously?