Re[2]: [PHP] redirecting
| From: | adwinwijaya | Date: | Wed, 18 Feb 2004 09:49:20 +0000 |
| Subject: | Re[2]: [PHP] redirecting | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-178080@lists.php.net to get a copy of this message | ||
Hello Ian,
Wednesday, February 18, 2004, 5:42:34 PM, you wrote:
IF> Stick something like this in your html <head></head>:
IF> <meta HTTP-EQUIV="REFRESH" CONTENT="5; URL=blah.php">
IF> Location won't work because you've already sent output to the browser.
IF> Ian
IF> On Wed, 2004-02-18 at 07:19, ajay wrote:
>> hi!
>>
>> after having trawled through many google articles, i've been told that the best
>> way to redirect a person is using header("Location:url");
>>
>> the problem is, i have form that is posted to another php script. This script then
>> processes the form and then writes up a html page and includes in that page any
>> warnings etc.
>> i want the user to have say 5s to read that page and then be redirected to
>> another page.
>> so i have something like
>> //process form
>> //write page
>> sleep(10);
>> header("Location:blah.php");
>>
>> the problem is i get an error when the script gets to the header part, the error
>> being
>> Warning: Cannot modify header information - headers already sent by (output
>> started at c:\program files\apache
>> group\apache\htdocs\usydbasketball\subscribe_mailing_list.php:6) in c:\program
>> files\apache
>> group\apache\htdocs\usydbasketball\subscribe_mailing_list.php on
>> line 67
>>
>> so how do i workaround that?
>>
>> thanks
>>
>> regards
>>
>> --
>> ajay
--> the best way to solve your problem is by using output buffering.
try to start with ob_start(); and at the end of your script call with
ob_end_flush() ;
hope it will work :)
--
Best regards,
adwinwijaya mailto:adwinwijaya@yahoo.com.au