Warning: session_start(): Cannot send session cookie - headers already sent by (outpu

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • samcode3
    New Member
    • Jun 2006
    • 4

    Warning: session_start(): Cannot send session cookie - headers already sent by (outpu

    Hi,
    I would be thankfull if anyone could give me the solution for this header problem. There are no blank spaces at end as there is html code in end. I have used <?php session_start() ;?> in first line and in between am checking this for session.

    <?php if($_SESSION['reg'] == "email"){ echo "username already taken. Please try another!"; $_SESSION['reg']="";} else if($_SESSION['reg'] == "user"){ echo "Email exist. If you have registered then please login!"; $_SESSION['reg']="";} ?>

    After this there is some html code.

    The error am getting is:

    Warning: session_start() : Cannot send session cookie - headers already sent by (output started at d:\myprojects\r egistration\ind ex.php:1) in d:\myprojects\r egistration\ind ex.php on line 1

    Please reply,
    -sam
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    It simply means that you have already sent something.
    Remember that, whe you send a header, NOTHING(!) may have been sent before that. So, before you display anything, do your header. Output means HTML, another header or even having a blank character after the end-PHP tag.

    Ronald :cool:>

    Comment

    • samcode3
      New Member
      • Jun 2006
      • 4

      #3
      Thankx Ronald.... But as u said is "Nothing(!) " an inbuilt function?

      Comment

      Working...