我使用FPDF在php中创建pdf,它总是显示空白文档。它的大小只有1.60kb。我获取mysql数据,并想接受卡。 我使用FPDF在php中创建pdf,它总是显示空白文档。它的大小只有1.60kb。我获取mysql数据并想要接受卡片。
(i)admitcard.php
<div class="container">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#viewapp">View Applications</a></li>
<li><a href="logout.php">Logout</a></li>
</ul>
<div class="tab-content">
<div id="viewapp" class="tab-pane fade in active">
<?php
$rs1 = mysqli_query($con,"select * from demodata");
echo '<table class="table table-striped" id="tblData">';
echo "<thead>";
echo "<tr>";
echo "<th>ID</th>";
echo "<th>NAME</th>";
echo "<th>DATE OF BIRTH</th>";
echo "<th>EMAIL ID</th>";
echo "<th>CONTACT NO.</th>";
echo "<th>SIGNUP DATE</th>";
echo "<tr>";
echo "</thead>";
echo "<tbody>";
while($ar = mysqli_fetch_array($rs1))
{
echo "<tr>";
echo "<td><a href='viewform.php?id=".$ar[0]."'>" . $ar[0] . "</a></td>";
echo "<td>" . $ar[3] . "</td>";
echo "<td>" . $ar[2] . "</td>";
echo "<td>" . $ar[4] . "</td>";
echo "<td>" . $ar[5] . "</td>";
echo "<td>" . $ar[6] . "</td>";
echo "<td> <a target='_blank' href='generate_pdf.php?id=".$ar[0]."'>
<input type='button' value='PDF' name='adcard' class='toggle btn btn-primary'> </a></td>";
echo "</tbody>";
echo "</table>";
?>
</div>
</div>
(ii)genrate_pdf.php
<?php
require("fpdf.php");
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$a=$_POST["add"];
$pdf->Cell(40,10,$a);
$pdf->Output();
?>