You are totally in the wrong way. I would use an <a> tag and onclick property for opening the PDF in popup & relocating the current page HTH Nitsan On 12/06/2008, Yashesh Bhatia <yasheshb@xxxxxxxxx> wrote: > > Hello: > > I'm trying to emulate a problem i'm trying to solve as follows. > > 1 - user enters information into a html form and submits > 2 - a php script is invoked on the submit and a pdf file is stamped > and made available for download > 3 - the script finally redirects the user to a thank you html page. > > i'm having a problem in the redirect to the thank you page. > here's the 3 files > ------------------------ 1.html ---------------------------- > <html><body> > <form action="2.php" method="post"> > First Name: <input type="text" name="firstname" /> > Last Name: <input type="text" name="lastname" /> > <input type="submit" /> > </form> > </body></html> > > ------------------------------------------------------------------------------------ > ---------------------------- 2.php ---------------------------- > <?php > // some stamping code ... > // open the file in a binary mode > $name = "2.pdf"; > fp = fopen($name, 'rb'); > > // send headers, dump the pdf file and finally redirect > header("Content-Type: application/pdf"); > header("Content-Disposition: attachment; filename=$name"); > header("Content-Length: " . filesize($name)); > fpassthru($fp); > > echo '<script type="text/javascript">'; > echo 'window.location.href="3.html";'; > echo '</script>'; > ?> > > ------------------------------------------------------------------------------------ > ---------------------------- 3.html ---------------------------- > <html><body> > Thank you for downloading 2.pdf > </body></html> > > ------------------------------------------------------------------------------------ > > The submit works fine and the pdf is availble for download however, > the redirect does not happen. > If i comment the lines > //header("Content-Type: application/pdf"); > //header("Content-Disposition: attachment; filename=$name"); > //header("Content-Length: " . filesize($name)); > //fpassthru($fp); > > then the redirect happens after the submit. > > i'm testing / running it on fedora core 6, Apache 2.2.5, php 5.2.5 and > firefox 1.5 > Any help / pointers is appreciated. > > Thanks. > > Yashesh Bhatia. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >