Hello everyone,

I have a post method form with a select list of specific names that I would like to output to pdf once selected and submitted.

I am able to output my content to pdf but I am unable to dynamically rename the file using the post or get method.

Here's the main portion of my code that outputs my content to pdf:
PHP Code:
  $name$_POST['name'];
  
$pdf = new PDF();
  
$pdf->load_html($_POST["html"]);
  
$pdf->set_paper($_POST["paper"], $_POST["orientation"]);
  
$pdf->render();

  
$pdf->stream($name); 
This will output my file to it's default name value "file.pdf"


However, if I hardcode my name variable like this:
PHP Code:
  $name="John Doe";
  
$pdf = new PDF();
  
$pdf->load_html($_POST["html"]);
  
$pdf->set_paper($_POST["paper"], $_POST["orientation"]);
  
$pdf->render();

  
$pdf->stream($name); 
My pdf file will output as "John Doe.pdf" which is exactly what I want.

I've tried using array strings and the implode function but none seem to work.
PHP Code:
$name= array('name' => $_POST['name']);
$namearray_shift$name); 
PHP Code:
$name= array('name' => $_POST['name']);
$nameimplode($name); 
Please let me know what I'm doing wrong? Thanks!