Error trying to use sessions

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
greg
New php-forum User
New php-forum User
Posts: 11
Joined: Wed Nov 13, 2002 6:56 am

Fri Jan 10, 2003 6:34 am

I copied code (an entire .php file) directly from an online tutorial and received the following error message:

"Warning: Cannot send session cookie - headers already sent by (output started ... on line 14"

Line 14 is simply "session_start();"

The php faq says "... headers can only be sent before all other content, check if your script is sending headers after having already sent content." And, I fix this how?

I have gotten the same or similar messages everytime I have tried to use sessions, even when using code straight from the PHP site.

greg
New php-forum User
New php-forum User
Posts: 11
Joined: Wed Nov 13, 2002 6:56 am

Fri Jan 10, 2003 9:46 am

Session_start() has to be placed above any HTML tags.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests