<?php
require('mysql_report.php');
$checkbox = $_GET['checkbox'];
//geting Array of values from GET methode
开发者_C百科foreach ($checkbox as $value)
{
$sql="SELECT name,address,email,problem,reply_query FROM query where id = $value ";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)){
}
$pdf = new PDF('L','pt','A4');
$pdf->SetFont('Arial','',12);
$pdf->connect('localhost','uname','pwd','mydb');
$attr = array('titleFontSize'=>18, 'titleText'=>'Report');
$qry=$pdf->mysql_report($sql,false,$attr);
}
$pdf->Output();
?>
here is the code i got the array of values from $_GET['checkbox']; how i got the pdf while the selected check boxes
You have placed the pdf generation code inside the foreach loop. It should be outside. Try this:
$sql="SELECT name,address,email,problem,type,other,reply_query FROM query where";
$i = 1;
foreach ($checkbox as $value)
{
if($i<count($checkbox))
{
$sql=$sql." id = \"".$value."\" OR";
$i++;
}
else
{
$sql=$sql." id = \"".$value."\"";
}
}
$pdf = new PDF('L','pt','A4');
$pdf->SetFont('Arial','',12);
$pdf->connect('localhost','root','asdfgh','Tree_help');
$attr = array('titleFontSize'=>18, 'titleText'=>'Treehealth Report');
$qry=$pdf->mysql_report($sql,$dump=false,$attr=array());
$pdf->Output();
This should give you the correct output :)
精彩评论