Page 1 of 1
header(location) [solved]
Posted: Thu Apr 28, 2011 10:01 am
by havoknz
Hi
me server is giving me this warning
stupid server wrote:Warning: Cannot modify header information - headers already sent by xxxx
im changing it with header(location:"index.php")
Anyone with some php knowledge can you help me?
Re: header(location)
Posted: Thu Apr 28, 2011 11:33 am
by ConceptDestiny
havoknz wrote:Hi
me server is giving me this warning
stupid server wrote:Warning: Cannot modify header information - headers already sent by xxxx
im changing it with header(location:"index.php")
Anyone with some php knowledge can you help me?
Do you have any includes in your page? (i.e. other pages included which also feature a header) If so, you may be sending multiple headers.
Re: header(location)
Posted: Thu Apr 28, 2011 1:57 pm
by hallsofvallhalla
you probably have a space in your top line or something above the header line
Re: header(location)
Posted: Thu Apr 28, 2011 7:50 pm
by havoknz
Why I asked is because it works fine on my wamp localhost but I loaded it up to my godaddy account and now it is giving me that.
Ill look at the white space issue.
I have one include that is initalizeall which loads up all of my included files. Lots of white space in that file...
I have made it into a function called redirect_to("$location") which parses the info into the header(location: "$location").
I thought it might be to do with the server settings...
Re: header(location)
Posted: Thu Apr 28, 2011 8:16 pm
by Xaleph
It has nothing to do with the header(); in PHP.
That error is given when output is already being flushed to the browser while PHP is not ready parsing the page. So you could kind of consider this, the value of $output is already being sent back as output to the browser while $output still has no value set to it. ( i`m not saying that`s your particular problem, but it illustrates the problem )
It means you have unfinished business you should clear before output should be sent. This usually means, like Halls mentioned, some whitespace somewhere.
difference:
<?php // has a space before opening bracket ( meaning output is already being sent to the browser )
<?php // means, first do PHP before anything else
Re: header(location)
Posted: Fri Apr 29, 2011 9:28 am
by havoknz
Thanks everyone.
Yeah I think I got it now..
Its all working so
