Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-10-2012, 12:23 AM   PM User | #1
Wuteverx1972
New Coder

 
Join Date: Aug 2010
Posts: 53
Thanks: 6
Thanked 1 Time in 1 Post
Wuteverx1972 is an unknown quantity at this point
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!
Wuteverx1972 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


Advertisement
Log in to turn off these ads.