header()

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

 



I'm having a bit of a problem understanding how the header() sends the HTTP 
headers.

Here's what I want to do:

1) Send a PDF file which will be printed in the client (the client will read 
it and print it if he wants to.
2) Redirect to the main page of the aplication.

Now, what happens to me is that, if I do (1) without (2), the PDF file is 
sent, but after printing and closing the PDF viewer, the browser stays in the 
old page, something I don't want.
If I put (1) and (2) I don't get the PDF to print. I just redirects to the new 
page.

Here is ths code (sorry about the comments on spanish :-) ):

    // Vamos a mandar el PDF
    header('Content-type: application/pdf');
    // El archivo se va a llamar libreDeuda.pdf
    header('Content-Disposition: attachment; filename="libreDeuda' . 
    	   '.pdf"');
    // El PDF fuente va a ser $ftexName.
    readfile($fpdfName);

    // Redirijimos todo.
    header("Location: " . $_SERVER["PHP_SELF"] . "?" . session_name() . 
    	   "=" . session_id());



-- 
 11:47:49 up 12 days, 20:16,  1 user,  load average: 0.33, 0.30, 0.65
-----------------------------------------------------------------
Martín Marqués        | select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica  |  DBA, Programador, Administrador
             Universidad Nacional
                  del Litoral
-----------------------------------------------------------------

-- 
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