I just recently started working with FPDF, but I'm still not sure how to pass in my own variables.
I would like to do something like
index.php:
...
//set name variable
$name = $_POST["name"]
//embed the pdf
<embed width="100%" height="100%" name="plugin" src="my-fpdf.php" type="application/pdf">
....
my-fpdf.php:
<?php
require('fpdf.php');
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$txt = "Hello ".$name."!" //access the variable
$pdf->Cell(40,10,$txt);
$pdf->Output();
?>
Is there a best practice on how to do this?
You'd need to add it as a query parameter:
<embed ... src="my-fpdf.php?name="<?php echo $name ?>" ...>
and then
$txt = "Hello, " . $_GET['name'];