watthehell Posted September 13, 2007 Share Posted September 13, 2007 hi all.. back again Now this time another problem (really a stupid one i think) I have the function to display calendar <?php function DisplayCalender($id,$month,$year) { //code and stuffs goes here.. theres no problem in it // here i stored the value of date in session $_SESSION['mydate']=$currdate; ?> and In the table part i echoed the $_SESSION value, but what happens is when the page loads the value of session does not come and when i refresh the page it comes. Why is this happening, can someone help me ... Quote Link to comment https://forums.phpfreaks.com/topic/69208-session-value-not-displaying-properly/ Share on other sites More sharing options...
adam_ Posted September 13, 2007 Share Posted September 13, 2007 maybe you didn't put session_start(); could we have a bit more of the code plz, or pastebin it Quote Link to comment https://forums.phpfreaks.com/topic/69208-session-value-not-displaying-properly/#findComment-347840 Share on other sites More sharing options...
watthehell Posted September 13, 2007 Author Share Posted September 13, 2007 I have kept Session Start, ob_start, ob_end_flush everything but it does not work... Is it problem of echoing a value(which is inside the function itself) before calling the function ?? Dont have the code now but will be posting it later... thnks.. Quote Link to comment https://forums.phpfreaks.com/topic/69208-session-value-not-displaying-properly/#findComment-347845 Share on other sites More sharing options...
phat_hip_prog Posted September 13, 2007 Share Posted September 13, 2007 Session variables are not set until next page! e.g. refresh / goto next page and they'll be there... Quote Link to comment https://forums.phpfreaks.com/topic/69208-session-value-not-displaying-properly/#findComment-347877 Share on other sites More sharing options...
watthehell Posted September 14, 2007 Author Share Posted September 14, 2007 Ohh then how to make it come before page refresh... any idea Quote Link to comment https://forums.phpfreaks.com/topic/69208-session-value-not-displaying-properly/#findComment-348220 Share on other sites More sharing options...
phat_hip_prog Posted September 14, 2007 Share Posted September 14, 2007 My book say's you can't... Quote Link to comment https://forums.phpfreaks.com/topic/69208-session-value-not-displaying-properly/#findComment-348256 Share on other sites More sharing options...
watthehell Posted September 14, 2007 Author Share Posted September 14, 2007 There must be a way somehow.. Does storing $_SESSION value inside a function shows this session value before calling the same function ?? Quote Link to comment https://forums.phpfreaks.com/topic/69208-session-value-not-displaying-properly/#findComment-348263 Share on other sites More sharing options...
redarrow Posted September 14, 2007 Share Posted September 14, 2007 get rid off the function then. Quote Link to comment https://forums.phpfreaks.com/topic/69208-session-value-not-displaying-properly/#findComment-348272 Share on other sites More sharing options...
watthehell Posted September 14, 2007 Author Share Posted September 14, 2007 get rid off the function then. Is that an answer ??? > Are you going to do it ??? Quote Link to comment https://forums.phpfreaks.com/topic/69208-session-value-not-displaying-properly/#findComment-348274 Share on other sites More sharing options...
redarrow Posted September 14, 2007 Share Posted September 14, 2007 if the session the problam why use a seeion then, i dont see no reel code post the full page please. ps. if i need to rewrite all your pages i will do it watch me. redarrow Quote Link to comment https://forums.phpfreaks.com/topic/69208-session-value-not-displaying-properly/#findComment-348282 Share on other sites More sharing options...
watthehell Posted September 14, 2007 Author Share Posted September 14, 2007 Oops.. i didn't mean that please have a look I got this function function DisplayCalender($id,$month,$year) { $date=date("d"); $month_curr=date("n"); $year_curr=date("Y"); // and i saved the value in session here if($i==$date && $year_curr==$year && $month_curr==$month) { // save the curr date in session $_SESSION['mycurrdate']=$year_curr.'-'.$month_curr.'-'.$i; $_SESSION['myselecteddate']=$month_curr.'-'.$year_curr; $_SESSION['currmonth'] = $month_curr; $_SESSION['curryear'] = $year_curr; $class_bg="cal_font_current"; $date_class="cal_font_current"; //$symbol1="car_curr"; //$symbol2="curr_sym"; } // other codes // end of function } And i called it here <td width="212" height="35" align="center" valign="middle" bgcolor="#EB208C" class="cal_font_month" style="background-image:url(images/navigationbg.jpg);"><?php echo @$_SESSION['mycurrdate']; ?></td> And after that i called the function <td height="226" colspan="2" valign="top" bgcolor="#EB208C"><? $id=1; $month=date("n"); $year=date("Y"); DisplayCalender($id,$month,$year); ob_end_flush(); ?></td> So any idea... Quote Link to comment https://forums.phpfreaks.com/topic/69208-session-value-not-displaying-properly/#findComment-348293 Share on other sites More sharing options...
phat_hip_prog Posted September 14, 2007 Share Posted September 14, 2007 ...will not become apparent until the user moves to a new page. Quote Link to comment https://forums.phpfreaks.com/topic/69208-session-value-not-displaying-properly/#findComment-348297 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.