CoderZone.org
Pages: 1 « previous     next »
  Print  
Author Topic: getting Cannot modify header error  (Read 4928 times) Bookmark and Share
toddbarret
Newbie
*
Posts: 1



View Profile
« on: Nov 30, 2010, 06:13:02 pm »

I'm getting a "Cannot modify header information" after adding a banner to my page. The banner shows but the page always shows this error. what am I doing wrong??
Logged
wheels
Jr. Member
*****
Posts: 62



View Profile
« Reply #1 on: Dec 01, 2010, 06:25:49 am »

If you have a session_start call, it must be called prior to any other output (such as XHTML or echo statements).

Code:  
Highlight Mode: (PHP)
  1. echo 'Wrong';session_start();
 
Code:  
Highlight Mode: (PHP)
  1. session_start();echo 'Right';
 

Please post your code if you need more help.
Logged
Mr. Crane
Jr. Member
*****
Posts: 63



View Profile WWW
« Reply #2 on: Dec 02, 2010, 08:55:27 pm »

wheels is right- you can't have *anything* sent to the browser before a session starts. Even a single space will cause this. Don't feel bad- this is one of those classic errors that every php programmer on Earth has run into. Smiley
Logged

Traveling through the Digital Age at 33⅓rd revolutions per minute.
Tags:
Pages: 1
  Print  
 
Jump to: