Hello,
I have composed the following simple php file:
<html>
<head><title> Title. </title></head>
<body>
<?php
header("Locatio n: http://www.something.c om/tmp2.php");
?>
</body>
</html>
And result of its execution is:
Warning: Cannot modify header information - headers already sent by
(output started at /home/something/public_html/tmp1.php:4) in
/home/something/public_html/tmp1.php on line 5
I thing, that in newsgroups I found a cause of my error:
"The reason you are getting this warning is because PHP is trying to
send a header (redirecting in this case) to browser, but it cannot,
because the output has already started."
But now I do not understand what is the use of header("Locatio n:
***");. It can be placed only in the beginning of files, and after
browser open this file it (browser) is immediatly redirected to second
file. Is it not better to open second file straight away (withou
opening the first file)? Further, what I need to do if I want to
diplay some file and than, let say in 20 second, user have to be
redirected to next file? What I need to do if I want to perform
redirection only if some variables have same defined values?
Pleas help me if you know answers.
Thank you.
I have composed the following simple php file:
<html>
<head><title> Title. </title></head>
<body>
<?php
header("Locatio n: http://www.something.c om/tmp2.php");
?>
</body>
</html>
And result of its execution is:
Warning: Cannot modify header information - headers already sent by
(output started at /home/something/public_html/tmp1.php:4) in
/home/something/public_html/tmp1.php on line 5
I thing, that in newsgroups I found a cause of my error:
"The reason you are getting this warning is because PHP is trying to
send a header (redirecting in this case) to browser, but it cannot,
because the output has already started."
But now I do not understand what is the use of header("Locatio n:
***");. It can be placed only in the beginning of files, and after
browser open this file it (browser) is immediatly redirected to second
file. Is it not better to open second file straight away (withou
opening the first file)? Further, what I need to do if I want to
diplay some file and than, let say in 20 second, user have to be
redirected to next file? What I need to do if I want to perform
redirection only if some variables have same defined values?
Pleas help me if you know answers.
Thank you.
Comment