Jump to content

Header error


Dville

Recommended Posts

So I have put together a membership area into the current script I am coding.

After some modding I seem to be getting this error.
[code]Warning: Cannot modify header information - headers already sent by. . .[/code]

It shows this error for line 171, 172, and 175.

I don't remember doing anything to the login page, but i believe it has to do with in if/else syntax issue. Thanks in advanced to anyone that can help.

go here to see the page im getting the errors on
http://phpfi.com/127501
Link to comment
https://forums.phpfreaks.com/topic/13661-header-error/
Share on other sites

The reason its doing that is because you are outputted text/html to the browser before you use setcookie and the header function

These functions cannot be used after there has been output. As they need to send header information to the server, but the header information has already been sent by the text/html.

The way to fix this is add ob_start(); after your opening <?php tag and add <?php ob_end_flush(); ?> after your closing html tag, line 213, so your code looks like this:
[code=php:0]  1 <?php
  2 ob_start();

// rest of lines

213 </html>
214 <?php ob_end_flush(); ?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/13661-header-error/#findComment-52978
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.