RE: [PHP] Quite a basic question[Scanned]
| From: | Michael Egan | Date: | Tue, 08 Mar 2005 15:25:10 +0000 |
| Subject: | RE: [PHP] Quite a basic question[Scanned] | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-210223@lists.php.net to get a copy of this message | ||
Mario,
From the PHP Manual:
"Remember that header() must be called before any actual output is sent, either by normal HTML
tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or
require(), functions, or another file access function, and have spaces or empty lines that are
output before header() is called. The same problem exists when using a single PHP/HTML file."
You cannot have anything being output to the browser before the header line.
See:
http://uk.php.net/manual/en/function.header.php
HTH,
Michael Egan
> -----Original Message-----
> From: Mário Gamito [mailto:lists@tuxdoit.com]
> Sent: 08 March 2005 15:19
> To: php-general@lists.php.net
> Subject: [PHP] Quite a basic question[Scanned]
>
>
> Hi,
>
> This is quite a very basic question, but i think the code
> following my
> signature should work.
> Instead, i get a
> "Warning: Cannot modify header information - headers already sent by
> (output started at /home/vhosts/dte/cv/register_action.php:10) in
> /home/vhosts/dte/cv/register_action.php on line 12"
>
> and no redirection :(
>
> How can i solve this ?
> Any help would be apreciated.
>
> Warm Regards,
> Mário Gamito
>
> <?php
>
> $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
> $sub_domain = explode (".", $hostname);
> if ($sub_domain[1] != 'dte') {
> echo"
> <script language=\"JavaScript\">
> window.open (\"http://www.google.com\",
> \"mywindow\",
> \"status=1,
> toolbar=0, resizable=0,
> width=200, height=200\");
> </script>";
> }
> header("Location: http://www.dte.ua.pt/cv/");
> ?>
>
> <HTML>
> <HEAD>
> <TITLE>Gestão de currículos do DDTE</TITLE>
> (...)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
The information contained in this email (and in any attachments sent with it) is confidential. It is
intended for the addressee only. Access to this email by anyone else is unintended and unauthorized.
If you are not the original addressee, 3tc asks you to please maintain confidentiality. If you have
received this email in error please notify 3tc immediately by replying to it, then destroy any
copies and delete it from your computer system.
Any use, dissemination, forwarding, printing or copying of this email by anyone except the addressee
in the normal course of his/her business, is strictly prohibited. 3tc owns the copyright in this
email and any document created by us and assert the right to be identified as the author of it.
Copyright has not been transferred to the addressee.
We protect our systems with Sophos Anti-virus -
www.sophos.com