I used checkbox to fetch all datas from database while i click a single checkbox the selected particular details geting downloading as pdf but when i click selectall checkbox ( all datas selected and fetched ) only single selection is downloading not all selections(pdf) are downloading
What I have tried:
<?php
require('fpdf.php');
require("custconnect.php");
if(isset($_POST['check']))
{
$checkbox = $_POST['check'];
for($i=0;$i<count($checkbox);$i++){
$del_id = $checkbox[$i];
$query1="SELECT * FROM `customer` WHERE id='".$del_id."'";
$result1=mysqli_query($connec,$query1);
while($row = mysqli_fetch_assoc($result1))
{
$zip = new ZipArchive();
$filename = "export_" . $row . ".zip";
if ($zip->open($filename, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE) !== true) {
echo "Cannot Open for writing";
}
$ext = $row['name'] . ".xml";
$zip->addFromString($ext, $row['name']);
$zip->close();
header("Content-disposition: inline; filename='.$filename'");
header('Content-type: application/zip');
readfile($filename);
unlink($filename);
}
}
mysqli_free_result($result);
mysqli_close($dbLink);
}
{
$pdf = new FPDF('P','mm','A4');
$pdf->AddPage('P','A4');
$pdf->SetFont( 'Arial', '', 17 );
$pdf->Cell( 145, 15, "INVOICE", 0, 1,'C' );
$pdf->SetFont('Arial','B',12);
$pdf->Cell(180 ,5,'InvoiceNo:',0,1);
$pdf->SetFont('Arial','',10);
$pdf->Cell(130 ,5,$row['date'],0,0);
$pdf->Cell(59 ,5,'',0,1);
$pdf->Cell(130 ,5,'[Monday]',0,0);
$pdf->Cell(189 ,10,'',0,1);
$pdf->Cell(15 ,8,' ______________________________________________________________________________________________',0,1);
$pdf->SetFont('Arial','',10);
$pdf->Cell( 180, 15, "GST", 0, 1,'C' );
$pdf->rect(140,75,68,50);
$pdf->Cell(189 ,10,'',0,1);
$pdf->Cell(130 ,0,'',0,0);
$pdf->Cell(90 ,5,$row['name'],0,1);
$pdf->Cell(130 ,5,'',0,0);
$pdf->Cell(90 ,5,$row['address'],0,1);
$pdf->Cell(130 ,5,'',0,0);
$pdf->Cell(90 ,5,$row['cn1'],0,1);
$pdf->rect(10,80,60,50);
$pdf->Cell(14 ,5,'Reymoro Ecommerce Private',0,1);
$pdf->Cell(25 ,5,'Limited,',0,1);
$pdf->Cell(50 ,5,'Saran Chambers, Vellayambalam, ',0,1);
$pdf->Cell(50 ,5,'Trivandrum District, ',0,1);
$pdf->Cell(50 ,5,'Ph- +91-9388499941, ',0,1);
$pdf->Cell(50 ,5,'Kerala,GSTIN-33ALAPG6547R2ZP ',0,1);
$pdf->Cell(50 ,5,'email : zshopy.shipment@gmail.com .',0,1);
$pdf->Cell(189 ,10,'',0,1);
$pdf->Cell(189 ,10,'',0,1);
$pdf->SetFont('Arial','B',12);
$pdf->Cell(34 ,5,'CommedityItem',1,0);
$pdf->Cell(21 ,5,'UnitPrice',1,0);
$pdf->Cell(20 ,5,'Quantity',1,0);
$pdf->Cell(25 ,5,'GrossValue',1,0);
$pdf->Cell(24 ,5,'TaxPercent',1,0);
$pdf->Cell(29 ,5,'TaxAmount',1,0);
$pdf->Cell(23 ,5,'Total',1,1);
$pdf->Image('fish.jpg',150,30,19);
$pdf->SetFont('Arial','',12);
$tax = 0;
$amount = 0;
$pdf->Cell(34 ,5,$row['product'],1,0);
$pdf->Cell(21 ,5,number_format($row['price']),1,0);
$pdf->Cell(20 ,5,number_format($row['quantity']),1,0);
$pdf->Cell(25 ,5,number_format($row['GrossValue']),1,0);
$pdf->Cell(24 ,5,number_format($row['Taxpercent']),1,0);
$pdf->Cell(29 ,5,number_format($row['txamount']),1,0);
$pdf->Cell(23 ,5,number_format($row['Total']),1,1);
$pdf->SetFont('Arial','',10);
$pdf->Cell(15 ,14,'
SOLD GOODS WILL NOT BE REFUNDED',0,1);
$pdf->Cell(15 ,8,'I here by acknowledge that the product is received In good condition.',0,1);
$pdf->Cell(15 ,8,'Customers Signature: _______________________ Receivers Sigunature: _______________________',0,1);
$pdf->Cell(15 ,8,'System Generated Invoice. Signature not required.',0,1);
$pdf->Cell(15 ,8,'Warranty Terms and condition:-',0,1);
$pdf->Cell(15,8,' Product once sold could not be refunded. Product sold covers under return policies within 10 days from',0,1); $pdf->Cell(15,2,'the date of delivery. Product covers under Service Warranty as per our warranty policies',0,1);
$pdf->Cell(15,8,'Return policies:- If in case the product delivered to the customer is in damage condition or have any size variation.',0,1);
$pdf->Cell(15,8,'Product should retuned back to address mentioned in the bill directly or through Courier within 10 days of delivery.',0,1);
$pdf->Cell(15,2,'Product should returned back with all its packing/Stickers. Product should be in unused condition as like as new one.',0,1);
$pdf->Cell(15,8,'Product should retuned back in customers own cost. Replacement delivery will be done under non chargeable Basis.',0,1);
$pdf->Cell(15,8,'Warranty policies:- Customers should visit nearest showroom/Service centre for getting serviced.',0,1);
$pdf->Cell(15,8,'Company is not responsible if we could not rectify the products after completion of warranty.',0,1);
$pdf->Cell(15,8,'Damage due to Fire, Electricity fluctuation, Misuse or improper handling will not covered under warranty. ',0,1);
$pdf->Cell(15,8,'Defective Spare parts will be taken back even if it falls under chargeable Service.
',0,1);
$pdf->Output();
}
?>