The following error appears
Warning: Cannot modify header information - headers already sent by (output started
The instruction is:
mysql_close($conexion);
$vuelta = "inicio.php";
header("Location: ". $vuelta);
exit;
Header
Moderator: General Moderators
-
bionicdonkey
- Forum Contributor
- Posts: 132
- Joined: Fri Jan 31, 2003 2:28 am
- Location: Sydney, Australia
- Contact:
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
-
sleepingdanny
- Forum Newbie
- Posts: 12
- Joined: Thu Mar 20, 2003 4:27 am
- Location: Israel
More easy explantion:
"header()" is need to be placed above the <html> tag or it will show the error...
1) mysql_close($conexion);
2) $vuelta = "inicio.php";
3) header("Location: ". $vuelta);
4) exit;
<html>
<head>
.....
The 3rd line is wrong - it should be
header("Location: . $vuelta"); and not header("Location: ". $vuelta);
"header()" is need to be placed above the <html> tag or it will show the error...
1) mysql_close($conexion);
2) $vuelta = "inicio.php";
3) header("Location: ". $vuelta);
4) exit;
<html>
<head>
.....
The 3rd line is wrong - it should be
header("Location: . $vuelta"); and not header("Location: ". $vuelta);
Last edited by sleepingdanny on Thu Mar 20, 2003 4:55 am, edited 2 times in total.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
That's a simple explanation but you can still get the error if you have whitespace above the <html> tag or if you echo() something above the <html> tag so it's not the whole answersleepingdanny wrote:More easy explantion:![]()
"header()" is need to be placed above the <html> tag or it will show the error...
Mac
-
sleepingdanny
- Forum Newbie
- Posts: 12
- Joined: Thu Mar 20, 2003 4:27 am
- Location: Israel
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
It is true - you cannot output anything (and whitespace counts as something) to the browser before calling the header() function. That is of course unless you use output buffering:sleepingdanny wrote:I don't know if this is true because it never happend to me
http://www.php.net/manual/en/ref.outcontrol.php
This is because PHP doesn't know HTML so it doesn't check to see if the function is being called before the <html> tag, it checks to see if the function is being called before there is any output to the browser.
Mac