Die Page, Die! (Was: Preview button to show PDF without submitting post data?)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



PHP List,

Okay, so I've got a nice situation where a form has a preview button as
well as a submit button. When the user presses "Submit", the page
reloads, and it emails a PDF.

If the user presses "Preview", it launches a new page in a new window,
and also outputs a PDF directly to the user so they can review it.

All good, but I don't need that second window open once the PDF has been
shown to the user.

For some reason I can't kill that second window. I've tried two methods.
Killing it with PHP, and killing it with JavaScript.

Here's the PHP version:

if (isset($_POST['preview']))
{
  $pdf->Output("preview.pdf", "D");
  die("PDF プレビュー出しました / PDF Preview Displayed");
}

Here's the JavaScript version:

if (isset($_POST['preview']))
{
  $pdf->Output("preview.pdf", "D");
  echo '<script type="text/javascript">javascript:self.close();</script>';
}

But in either case, I keep getting that second page coming out, with the
whole form rendered all over again.

How can I kill a page? Once the PDF is rendered, I don't need it. I'd be
okay if it came down to the browser then closed, but it would be better
if the server sent the PDF and didn't send the page.

Any advice would be much appreciated.

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux