Log in

View Full Version : Argh php help?



Bojangles
04-04-2008, 09:46 PM
Hey guys, I keep getting this STUPID error, it may be something totally obvious or the fact I haven't stopped coding for the past few days and getting tired :P

Basically I'm building a CMS and when the user logs in I want it to display "Hi $username welcome to the panel!';

So I create a welcome.php file and use a php include in the box I want it to display the text but it displays it but I get a stupid cache error :S


Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/igoboy/public_html/cms/userpanel.php:6) in /home/igoboy/public_html/cms/welcome.php on line 9
Hi lucas, welcome to your panel! You have 0 new messages since you last logged in!Any ideas guys? Also I've checked the code and it looks fine.

Moved by jesus (Forum Super Moderator) from Designing & Development: Please post in the correct section next time.

Robbie
04-04-2008, 09:51 PM
You have session_start(); on an included page and the page you are including on.

Bojangles
04-04-2008, 09:54 PM
You have session_start(); on an included page and the page you are including on.
Nope, I've only included the file into the userpanel, haven't started any sessions.


<div id="box"><?php include("welcome.php"); ?></div>

Thats the only php I have in my userpanel atm (started a new one)

Invent
04-04-2008, 10:10 PM
I do believe sessions cannot be initialized after html is outputted. Not completely sure though.

Agnostic Bear
04-04-2008, 10:13 PM
I do believe sessions cannot be initialized after html is outputted. Not completely sure though.

This is correct, initialize them at the top of the page before any HTML.

Bojangles
04-04-2008, 10:14 PM
I do believe sessions cannot be initialized after html is outputted. Not completely sure though.
Ahh crap, thanks anyway :)
I can just put it in the userpanel.php file but when I do that php has to be at the top, and it displays "Welcome lucas" at the top of the page rofl.

@Lolcopters - Yeah I put the whole of welcome.php at the top of the page before inserting html but then it just went to the top so I thought ohh.. php include :P

Want to hide these adverts? Register an account for free!