CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   PHP (http://www.codingforums.com/forumdisplay.php?f=6)
-   -   How to pass a post or get method array into stream() function (http://www.codingforums.com/showthread.php?t=275948)

Wuteverx1972 10-10-2012 12:23 AM

How to pass a post or get method array into stream() function
 
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!


All times are GMT +1. The time now is 08:56 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.