Click here to Skip to main content
15,667,735 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

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:


//db connection

//get invoices data

/*class PDF extends FPDF 

	function Header(){
		$this->Cell(100,10,'this is header',0,1);

	function Footer(){
		$this->Cell(100,10,'this is Footer',0,1);
//A4 width : 219mm
//default margin : 10mm each side
//writable horizontal : 219-(10*2)=189mm

    //$checkbox = $_POST['check'];
    $checkbox = $_POST['check'];

		$del_id = $checkbox[$i];
		$query1="SELECT * FROM `customer` WHERE id='".$del_id."'";
//$query="SELECT * FROM `customer`";

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"; // taking file name from DB and adding extension separately
                $zip->addFromString($ext, $row['name']); //adding blob data from DB

             header("Content-disposition: inline; filename='.$filename'");
            header('Content-type: application/zip');

    // Free the mysqli resources     


$pdf = new FPDF('P','mm','A4');



//$pdf->SetTextColor( 123,79,443);
$pdf->SetFont( 'Arial', '', 17 );
//$pdf->Cell( 0, 15, "INVOICE", 0, 1, 'C' );
$pdf->Cell( 145, 15, "INVOICE", 0, 1,'C' );
//set font to arial, bold, 14pt



//Cell(width , height , text , border , end line , [align] )

$pdf->Cell(180	,5,'InvoiceNo:',0,1);
//$pdf->Cell(59	,5,'INVOICE',0,1);//end of line

//set font to arial, regular, 12pt

$pdf->Cell(130	,5,$row['date'],0,0);
$pdf->Cell(59	,5,'',0,1);//end of line

$pdf->Cell(130	,5,'[Monday]',0,0);
//end of line

//make a dummy empty cell as a vertical spacer
$pdf->Cell(189	,10,'',0,1);//end of line

//billing address

$pdf->Cell(15	,8,' ______________________________________________________________________________________________',0,1);
$pdf->Cell( 180, 15, "GST", 0, 1,'C' );
//$pdf->Cell(1	,5,'GST',0,1);

$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);
//add dummy cell at beginning of each line for indentation
$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 : .',0,1);

$pdf->Cell(189	,10,'',0,1);//


//make a dummy empty cell as a vertical spacer
$pdf->Cell(189	,10,'',0,1);//end of line
//invoice contents

$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);


//end of line


$tax = 0; //total tax
$amount = 0; //total amount

//display the items; //total amount

//display the items

	$pdf->Cell(34	,5,$row['product'],1,0);
	//add thousand separator using number_format function
	$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 -> Line(2500, 250, 2500, 0);
//$width=$pdf -> 15; // Width of Current Page
//$height=$pdf -> 12; 
//$pdf -> Line(250, 250,0,0);// Height of Current Page
//for($i=0;$i<=$height;$i +=10){
//$pdf -> Line(0,0,  $pdf -> w, $i);

	//end of line
	//accumulate tax and amount

$pdf->Cell(15	,14,'
$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,'  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.

// url
// (substr($image, 0, 3) == 'II*'){ // TIF file


Bryian Tan 2-Nov-18 7:52am    
this might help : PHP Zip File Functions[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900