Search code examples
phpfpdf

FPdf - echo input into table header


I'm doing a monthly report and I want to echo at my table header the selected month in my drop down list here is my code:

$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);
    }

how can I print the $month in my header? thanks


Solution

  • Simply adding $month will print out the month. For example if you wanted to change "Employee Leave Monthly Report" to "Employee Leave Monthly Report for May" (where May is the month in the $month variable) you would have@

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

    EDIT: Try this

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