Jump to content

[SOLVED] A simple problem with SESSION


watthehell

Recommended Posts

hi all...

 

my code goes like this :

 

I have a function

 

<?php function DisplayCalender($id,$month,$year)
{
  // other stuffs are here... it is long so i didnt post
  
  // I have this part in this function 
  
if($i==$date && $year_curr==$year && $month_curr==$month)
	{
		// save the curr date in session
		$_SESSION['mycurrdate']=$i.'-'.$month_curr.'-'.$year_curr;
		$_SESSION['myselecteddate']=$month_curr.'-'.$year_curr;
		$class_bg="cal_current_bg";
		$date_class="cal_font_current";
		$symbol1="car_curr";
		$symbol2="curr_sym";
	}
  // end of function 

}?>

 

here in the function I have stored the current date in SESSION

$_SESSION['mycurrdate']=$i.'-'.$month_curr.'-'.$year_curr;

 

and in the html code

 

<table width="247" border="0" cellpadding="0" cellspacing="0" bgcolor="#AA0F61">
  <!--DWLayoutTable-->
  <tr>
   <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>
   <td width="35" align="center" valign="middle" bgcolor="#EB208C" class="cal_font_month" style="background-image:url(images/navigationbg.jpg);"><a href="#" class="cal_font_month">>></a></td>
  </tr>
   <tr>
    <td height="226" colspan="2" valign="top" bgcolor="#EB208C"><?
$id=1;
$month=date("n");
$year=date("Y");
DisplayCalender($id,$month,$year);


 ?></td>
  </tr>
</table>

 

I echo-ed the session value, but when the page loads it comes blanks and when i refresh the page the date value comes...

 

Any idea why this happens..

 

Thanks..

Link to comment
Share on other sites

Thanks a lot [redarrow] now it is working...

 

put this on the bottom of the page.

 

<?php

ob_end_flush();

?> 

 

stupid question, but do you have any code above the snipet that you are posting?

And this one for you kireol...

 

SEE THE DIFFERENCE OF BEING A GURU AND A NEWBIE  ;) ;) ha ha ha ha....

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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