...

View Full Version : How to pass a post or get method array into stream() function



Wuteverx1972
10-10-2012, 12:23 AM
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:


$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:


$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.


$name= array('name' => $_POST['name']);
$name= array_shift( $name);



$name= array('name' => $_POST['name']);
$name= implode($name);


Please let me know what I'm doing wrong? Thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum