canishk Posted September 27, 2007 Share Posted September 27, 2007 am trying to implement session variables in my new php project. I would like to know can i set and get variables in session... my current program contains: page 1: session_start(); $_SESSION['$uid']=$u; page 2: session_start(); $u=$_SESSION['$uid']; echo("$u"); but i got this warning with the result.. Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent how can i solve this?? please help Quote Link to comment https://forums.phpfreaks.com/topic/70854-php-session-need-urgent-help/ Share on other sites More sharing options...
d.shankar Posted September 27, 2007 Share Posted September 27, 2007 Page1.php <?php session_start(); $_SESSION['$uid']="Hello"; ?> Page2.php <?php session_start(); $u=$_SESSION['$uid']; echo($u); ?> Check out this. Quote Link to comment https://forums.phpfreaks.com/topic/70854-php-session-need-urgent-help/#findComment-356198 Share on other sites More sharing options...
GingerRobot Posted September 27, 2007 Share Posted September 27, 2007 The problem is that you're sending some data to the browser prior to the session_start() function, which you cannot do. This could be just whitespace - for instance, if you're opening php tag is after any whitespace character, you will get this error. Check this thread: http://www.phpfreaks.com/forums/index.php/topic,37442.0.html Quote Link to comment https://forums.phpfreaks.com/topic/70854-php-session-need-urgent-help/#findComment-356213 Share on other sites More sharing options...
localhost1 Posted September 27, 2007 Share Posted September 27, 2007 the variable u r assigning in first page n second are same so change code of second page to this session_start(); $v=$_SESSION['$uid']; echo("$v"); Quote Link to comment https://forums.phpfreaks.com/topic/70854-php-session-need-urgent-help/#findComment-356214 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.