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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.