Re: redirection...
| From: | Jason Bryner | Date: | Thu, 13 Jul 2000 19:51:33 +0000 |
| Subject: | Re: redirection... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-6530@lists.php.net to get a copy of this message | ||
on 7/13/00 2:29 PM, Rasmus Lerdorf at rasmus@php.net wrote:
> Put your PHP block before any of the HTML.
>
> -Rasmus
>
> On Thu, 13 Jul 2000, Subhrajyoti Moitra wrote:
>
>> hi list,
>> have a look at the code below...
>>
>> <?
>> session_start();
>> ?>
>>
>> <html>
>> <head>
>> <title>Untitled Document</title>
>> <meta http-equiv="Content-Type" content="text/html;
>> charset=iso-8859-1">
>> </head>
>> <?
>> global $linkid;
>> switch($linkid){
>> case 1: header("location: http://www.yahoo.com");
>> break;
>> case 2: header("location:
>> http://www.google.com");
>> break;
>> }
>> ?>
>>
>> it gives me the error that:
>>
>> Warning: Cannot add header information - headers already sent by (output
>> started at /home/subhra/public_html/php/al/test.php:2) in
>> /home/subhra/public_html/php/al/test.php on line 7
>>
>> the error is pretty obvious ... since the header is already sent .. hence
>> resending another header generates this warning and the switch doesnot get
>> processed... how do i go about redirecting... under such circumstances...
>> am i missing something.. please help .. i am stuck ....
>>
>> -----------------------------------------------------------------------------
>> ---------
>> SECURITY IS A MYTH........!!!!!!!!
>> "Linux for people with avg. IQ above 98"
>> -----------------------------------------------------------------------------
>> ---------
>> Subhrajyoti Moitra ------- C/212 Hall-I IIT-Kanpur India 208016
>> email: subhra@iitk.ac.in
>>
>>
>>
>>
>
Look for a very annoying extra line or space at the beginning or end of the
file, or one of the include files. I don't know how many times I've had the
same error, just becuase of some dumb extra line.
Jason Bryner
jrbryner@southern.edu