我最近才开始使用TCPDF,我显示的输出页面和表标题也显示出来,并且也可以查询,但是get id为NULL为何?
通过URL通过URL传递ID
<h4><a href="pdf_1.php?$h_id=<?php echo $id;?>">Conver PDF</a></h4>
id显示在url中,但是我var_dump显示NULL的h_id
我的pdf_1页面
<html>
<head>
<style>
table,td,th{border:1px solid black;}
</style>
</head>
<body>
<?php
include_once '../connect.php';
require_once('Pdf.php');
function runQuery($query) {
$result = mysql_query($query);
while($row=mysql_fetch_assoc($result)) {
$resultset[] = $row;
}
if(!empty($resultset))
return $resultset;
}
$h_id=$_GET['h_id'];
$pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false);
$pdf->SetTitle('Orders Report');
$pdf->SetHeaderMargin(30);
$pdf->SetTopMargin(20);
$pdf->setFooterMargin(20);
$pdf->SetAutoPageBreak(true);
$pdf->SetAuthor('Author');
$pdf->SetDisplayMode('real', 'default');
$pdf->AddPage();
$product_array =runQuery("SELECT * FROM tbl_invoic_details LEFT JOIN tbl_sudent_bill ON tbl_sudent_bill.stu_bill_id=tbl_invoic_details.bill_id Where tbl_sudent_bill. hostel_id='$h_id'");
$html1 ='<table>
<tr>
<th>Serial no</th>
<th>Roll_no</th>
<th>Total Amount</th>
<th>Date</th>
<th>Reference_no</th>
</tr>
</table>';
$pdf->writeHTML($html1, true, false, true, false, '');
if (!empty($product_array)) {
$i=1;
foreach($product_array as $key=>$row){
$html = '<table>
<tr>
<td>'.$i++.'</td>
<td>'.$product_array[$key]['roll_no'].'</td>
<td>'.$product_array[$key]['total_amnt'].'</td>
<td>'.$product_array[$key]['date'].'</td>
<td>'.$product_array[$key]['reference_no'].'</td>
</tr>
</table>
';
$pdf->writeHTML($html, true, false, true, false, '');
}}
ob_end_clean();
$pdf->lastPage();
$pdf->Output('pdf_1.php');
?>
</body>
</html>
如何在我的页面中获取h_id,请帮助我在此先感谢
在网址中传递ID,例如
<h4><a href="pdf_1.php?h_id=<?php echo $id;?>">Conver PDF</a></h4>
我将从h_id中删除'$'