Jump to content

Recommended Posts

I'm working on a application that uses menu that relies on session data. Menu options change depending on what value is set in session variable. Because new session variable is always available until after next reload of a page the menu is shown incorrectly after first refresh (meaning there's no changes).

Does anybody have idea how to make it work, or maybe I should use some different approach? Any suggestions?

 

Thanks

Marcin

A cookie behaves the way you mentioned, not a session.

 

If you are in fact describing a cookie, you can always set the correct $_COOKIE variable to the same value you just put into the setcookie() statement.

Perhaps you are having an issue understanding what happens - when.  When you set a $_SESSION variable, it is available in the scope in exactly the same way that any other variable is available. 

 

It sounds like the issue may be that in your script you output some html, then perform some logic -- set the $_SESSION variable, and this does not change your already emitted html! 

 

You need to have a clear idea in your mind about how HTTP works, and how the browser works with the server. 

You guys are right, cookies behave this way not sessions. Anyway I'm using CodeIgniter for the first time for my project. I'm not in 100% understand this whole OO concept so that's where the problem is :) I'm doing something in wrong sequence.

 

Thanks

 

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.