Join 132,688 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,274 people online right now. Registration is fast and FREE... Join Now!
Warning: Cannot modify header information - headers already sent by (output started at /home/ils/public_html/protocal/login.php:12) in /home/ils/public_html/protocal/login.php on line 14
You'll get that error when you send something to be printed to the browser before you set the header. You need to do your header before you output any data. If you have something like this
You'll get a header already sent error. You need to put the header redirect before any echo statements, or any html that you have in the code. You may have to rethink the setup of that file or process. If you post the whole thing we'll be able to help you find the specific area where the problem started. Otherwise you can figure it out by running through your code.
Actually JBrace, akozlik is right. Header is a function and is not something you echo such as a statement or variable. If a user sends data to the client, the server automatically flushes the headers and sends those. Thus if you try to use a header call (which modifies headers) it will error because the headers have already been given to the client in the response stream.
header() appends header information to the headers of a response page. Any output sent to the client (a space, a tab, some info that has been echoed or simply printed) causes headers to be sent and, if prior to a header() call, it will cause the header() call to fail.
Read up on the user of header() at php.net to learn more.
This post has been edited by Martyr2: 31 May, 2008 - 04:37 PM
Actually JBrace, akozlik is right. Header is a function and is not something you echo such as a statement or variable. If a user sends data to the client, the server automatically flushes the headers and sends those. Thus if you try to use a header call (which modifies headers) it will error because the headers have already been given to the client in the response stream.
header() appends header information to the headers of a response page. Any output sent to the client (a space, a tab, some info that has been echoed or simply printed) causes headers to be sent and, if prior to a header() call, it will cause the header() call to fail.
Read up on the user of header() at php.net to learn more.
*dies* i'm not thinking correctly today.. =/ been spending too much time in the sun T.T
not enjoying it here.... i'm stuck doing yard work.... my skins like wicked dark now, and i'm usually really light
i'd swear to god, i look like a miner D=
Blah, yardwork sucks. That's the nice thing about living in an apartment I guess. It's been hot as balls in Florida. I don't even want to think about going outside during the day.
^ The trickiest thing about scripts, and probably the best advice on things like this is, any whitespace such as this
CODE
<?php //do something ?>
Or this
CODE
<?php //stuff
Any whitespace before, after, in between php tags will cause output and mess with your headers and such.
Best advice is whenever you include files, on all files included, its best practice to leave off the trailing ?> so that you do not have erroneous output.
This post has been edited by joeyadms: 1 Jun, 2008 - 01:29 PM