Jump to content


Photo

Header error


  • Please log in to reply
2 replies to this topic

#1 Dville

Dville
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts

Posted 04 July 2006 - 06:04 PM

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.
Warning: Cannot modify header information - headers already sent by. . .

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

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 04 July 2006 - 06:17 PM

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:
  1 <?php
  2 ob_start();

// rest of lines

213 </html>
214 <?php ob_end_flush(); ?>


#3 Dville

Dville
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts

Posted 04 July 2006 - 06:27 PM

bad ass, i'd give you a karma point if i knew how, lol

im not sure what this function truely does. but i'll try to make some sense of it @php.net
thanks again wild




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users