title: What is the correct way to pass a PHP variable to FPDF?
body: <p>I just recently started working with FPDF, but I'm still not sure how to pass in my own variables.</p>
  
  <p>I would like to do something like</p>
  
  <p>index.php:</p>
  
  <pre><code>...
  //set name variable
  $name = $_POST["name"]
  
  //embed the pdf
  &lt;embed width="100%" height="100%" name="plugin" src="my-fpdf.php" type="application/pdf"&gt;
  ....
  </code></pre>
  
  <p>my-fpdf.php:</p>
  
  <pre><code>&lt;?php
      require('fpdf.php');
  
      $pdf = new FPDF();
      $pdf-&gt;AddPage();
      $pdf-&gt;SetFont('Arial','B',16);
      $txt = "Hello ".$name."!" //access the variable
      $pdf-&gt;Cell(40,10,$txt);
      $pdf-&gt;Output();
  ?&gt;
  </code></pre>
  
  <p>Is there a best practice on how to do this?</p>