Jump to content

Session Value not displaying properly


watthehell

Recommended Posts

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 ...

 

 

Link to comment
https://forums.phpfreaks.com/topic/69208-session-value-not-displaying-properly/
Share on other sites

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..

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...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.