Re: [PHP] Preview button to show PDF without submitting post data?

2009-11-07 Thread Ashley Sheridan
On Sat, 2009-11-07 at 14:59 +0900, Dave M G wrote:

 Fernando,
 
 Thank you for responding.
 
  You could just open in a new window a php script that generates the 
  preview pdf with a content-type header for pdf.
 
 Yes, but how would the form data be carried over to the new window?
 
 The thing is that I have all this form data that the user has entered,
 and before they submit it to be stored in the database, they want to see
 it in a PDF file.
 
 If I just point the link to a new script that generates the PDF, won't
 the form data be lost?
 
 Or is can I attach Post data to the new window?
 
 -- 
 Dave M G
 


The form data doesn't have to be lost. You can post it to an
intermediate script that creates the PDF and holds the data. You could
use Javascript to change the original form slightly so that it opens in
a new window (set a target attribute) and then remove it immediately
after. There are quite a few ways you can do all of this.

Thanks,
Ash
http://www.ashleysheridan.co.uk




[PHP] Preview button to show PDF without submitting post data?

2009-11-05 Thread Dave M G
PHP Users,

I have a page that generates a PDF document using PHP. It takes form
data filled in by the user to fill out the PDF

When the user clicks submit, it emails that PDF document to the
intended recipient.

However, I would like to add a preview function as well. But for a
variety of reasons, instead of submitting the form data through post and
re-filling all the fields with the selected data, I'd like to be able to
open a new window with an example PDF without actually submitting the form.

I think this might need JavaScript, but I'm not sure.

Is this possible?

Thank you for any advice.

-- 
Dave M G

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Preview button to show PDF without submitting post data?

2009-11-05 Thread Fernando Castillo Aparicio
You could just open in a new window a php script that generates the preview 
pdf with a content-type header for pdf.

header(Content-type: application/pdf);

Or if the preview pdf is not dinamic, just point the url to the pdf.

No javascript needed, just a link, o a submit button on a form with the
url as the action attribute. If you need it to open on a new window,
use target=_blank, or better target=pdf if you want consecutive
requests to open in the same window instead of a new one everytime.

Note: if you are not using transitional html and care about validation, the 
target attribute is not allowed. In that case you would need javascript to open 
a new window.





De: Dave M G mar...@autotelic.com
Para: PHP-General List php-general@lists.php.net
Enviado: vie,6 noviembre, 2009 04:58
Asunto: [PHP] Preview button to show PDF without submitting post data?

PHP Users,

I have a page that generates a PDF document using PHP. It takes form
data filled in by the user to fill out the PDF

When the user clicks submit, it emails that PDF document to the
intended recipient.

However, I would like to add a preview function as well. But for a
variety of reasons, instead of submitting the form data through post and
re-filling all the fields with the selected data, I'd like to be able to
open a new window with an example PDF without actually submitting the form.

I think this might need JavaScript, but I'm not sure.

Is this possible?

Thank you for any advice.

-- 
Dave M G

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php