By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,058 Members | 1,217 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,058 IT Pros & Developers. It's quick & easy.

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

P: 4
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\registration\index.php:1) in d:\myprojects\registration\index.php on line 1

Please reply,
-sam
Jun 9 '06 #1
Share this Question
Share on Google+
2 Replies


ronverdonk
Expert 2.5K+
P: 4,258
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:>
Jul 22 '06 #2

P: 4
Thankx Ronald.... But as u said is "Nothing(!)" an inbuilt function?
Jul 22 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.