LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Using PHP to output HTML and download a fie

[ILUG] Using PHP to output HTML and download a fie

Francis Daly francisdaly at gmail.com
Sun Feb 12 20:41:16 GMT 2012


On 12/02/2012, Niall O Broin <niall at linux.ie> wrote:

Hi there,

> when
> the user clicks the submit button, having entered the necessary data, I want
> him to get a confirmation page AND have the PDF downloaded in one action.

I'd suggest not doing that.

Keep it as one request -> one response, and you'll probably find
things much easier.

If that is an acceptable solution, then you'll have request#2 which
results in the PDF being returned, and request#1 which results in the
html confirmation page which includes a normal link to request#2, and
which also induces the browser to make request#2 itself, via a html
meta http-equiv tag, or via a javascript handler, or by some other
means.

Look at what happens when you try to download something from
sourceforge, for an example of how it can work.

> This question is probably more proper to a PHP list, but I'm not on any of
> those, and the platform in use is Linux, so . . .

"sourceforge" is a repository of some software that can run on Linux,
which preserves the tenuous link to being on-topic.

If you really want to do a multipart response, then the first question
is "do my target browsers support this adequately"; then comes "how do
I do the http-and-wrapping parts correctly in php"; and after that
"how to I fit the intended output into that wrapping".

I don't know the answers to any of those, which I why I suggest
avoiding the questions and causing two requests to be made (although
one should be automagically done by the browser).

Good luck with it,

  f


More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell