FPDF - output dynamic file name

Viewed 8064

I'm creating a PDF page from an html form, so my php looks like this (for example):

$pdf->Cell(0,0,$_POST['teacher_name'],0,2,'C');

What is my missing step that I can define that variable (teacher_name) to create my output file as:

$pdf->Output('homework-teacher_name.pdf', 'D');

and the teacher_name in the output is replaced by whatever is submitted in the form?

3 Answers
$fullname = $row["fullname"];

$pdf_file_name = $fullname.".pdf";

$pdf->Output($pdf_file_name,'D');

It is working.

Related