Jump to content

Tabbed Web Portal and Cookies


ThePsion5

Recommended Posts

Hi,I am in the process of creating a tabbed web page using javaScript and PHP. The basic idea is to display one of three menus from which the user can pick various items to be displayed on another section of the page. In addition, the page must remember what tab the user last chose and display it the next time the web page has been visited. Optionally, this page can remember the last menu item the user visited as well, and this option can be turned on or off at the bottom of the page.However, I am running into a bit of a problem. My code is set up that a cookie (consisting of the ID of the last tag chosen, the last menu item chosen, and a setting to remember the menu item or not) is modified at the following times:1. When a tab is clicked2. When a menu item is chosen (the page reloads since PHP code handles the display of actual content)3. The "remember menu item" is modifiedThe problem with this approach is that my PHP code retrieves values from the cookie, and displays a default item if the "remember menu item" option is turned off. But since the page refreshes every time a menu item is chosen, this creates a problem. Since the PHP pulls code directly from a cookie, if the "remember menu item" option is turned off it will always display the default page no matter what the user clicks. PHP won't let me modify the cookie values outside of the header, either. Any suggestions (I can post code if that would help). Thanks in advance!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...