FPdf - 将echo输入到表头中

时间:2015-01-19 05:27:47

标签: php fpdf

我正在做月度报告,我希望在我的表格标题中回显我的下拉列表中选定的月份,这是我的代码:

$month=$_POST['month'];
$year=$_POST['year'];
mysql_connect('localhost','root','');
mysql_select_db('auth');

class PDF extends FPDF
{
    // Page header
    function Header1()
    {
        // Logo
        $this->Image('header.png',30,10,150);
        $this->SetFont('Arial','',15);
        $this->Cell(0,89,'Employee Leave Monthly Report',0,0,'C');
        $this->Ln(53);
    }

如何在标题中打印$ month?感谢

2 个答案:

答案 0 :(得分:1)

只需添加$month即可打印出月份。例如,如果您想更改"员工休假月报"至于"员工休假月报及#34; (其中May是$ month变量中的月份)你将拥有@

$this->Cell(0,89,"Employee Leave Monthly Report for $month",0,0,'C');

编辑:试试这个

$this->Cell(0,89,'Employee Leave Monthly Report for ' . $month,0,0,'C');

答案 1 :(得分:0)

答案似乎只是$_POST[month]