Page 1 of 1
Header problem
Posted: Tue Sep 04, 2007 6:24 am
by kkonline
Below is the extract of the problem part of the else loop. It gives me a parse error for the header line, the url is send from the previous page and is available as $_POST['url'] in general throughout the processing script.
Code: Select all
else
{
header( refresh: 2; url=$_POST['url'] );
echo 'Message has been sent.';
}
Posted: Tue Sep 04, 2007 6:30 am
by miro_igov
Of course
Code: Select all
header('refresh: 2; url='.$_POST['url']);
Posted: Tue Sep 04, 2007 6:52 am
by kkonline
miro_igov wrote:Of course
Code: Select all
header('refresh: 2; url='.$_POST['url']);
that means argument to header() is a string.
Posted: Tue Sep 04, 2007 7:48 am
by miro_igov
Yes, click on the header in the PHP snippet of your post and you will read about this function.
Posted: Tue Sep 04, 2007 7:49 am
by s.dot
The contents of a header() call are not the same as that of a meta tag.
If you want to wait 2 seconds before loading the next page.. you have two options.
1:
Code: Select all
sleep(2); //sleep two seconds
header('Location: ' . $_POST['url']);
2: Generate an HTML page with a meta tag like the header you're currently trying to send.
Posted: Tue Sep 04, 2007 9:31 am
by kkonline
scottayy wrote:The contents of a header() call are not the same as that of a meta tag.
If you want to wait 2 seconds before loading the next page.. you have two options.
1:
Code: Select all
sleep(2); //sleep two seconds
header('Location: ' . $_POST['url']);
2: Generate an HTML page with a meta tag like the header you're currently trying to send.
Scottayy is there anything wrong if i use
Code: Select all
header('refresh: 2; url='.$_POST['url']);
any bug or any reason for which i should not use it, and use
Code: Select all
sleep(2); //sleep two seconds
header('Location: ' . $_POST['url']);
Posted: Wed Sep 05, 2007 12:07 pm
by feyd
The refresh header is non-standard, and only supported by a few servers/browsers.