FPDF html表显示来自mysql的数据

时间:2015-01-19 08:30:16

标签: php fpdf

我是fpdf的新手,我在如何根据输入字段显示数据时遇到问题。在myh输入字段php文件中我会输入名称,日期等,我有一个打印按钮,当我点击它时会自动打印我在该字段中输入的内容。现在我希望以表格格式打印。以下是fpdf文件:

<?php

$html = <<<MYTABLE

<table border="1" style="width:90%" title="Leave" cellpadding="5px" align="center">
    <tr>
        <td rowspan=1 width="70"   align:"top-left"><center><b>1. Name:</b></center><br><select name="office_agency"></td>
        <td rowspan=1 width="100"  colspan="2" align:"top-left"><b>2. ID&nbsp;&nbsp; / &nbsp;&nbsp;&nbsp; Date</b><br> </td>
    </tr>
    <tr>
        ......
    </tr>
</table>

MYTABLE;
require('pdftable.inc.php');

mysql_connect('localhost','root','');
mysql_select_db('auth');

$p = new PDFTable();
$p->AddPage();
$p->setfont('times','',10);
$p->Cell(5,-5,'APPLICATION FOR LEAVE');
$p->Ln(3);
$p->htmltable($html);
$p->output();
?>

有。如何将代码用于获取html格式之后输入的数据,还是有什么办法呢?感谢

1 个答案:

答案 0 :(得分:0)

在这里你不能使用html表进行直接显示,你可以使用col()语法创建表格以获取更多检查链接[here] http://www.fpdf.org/en/script/script14.php