Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 569795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:20:00+00:00 2026-05-13T13:20:00+00:00

I am trying to build a system the remembers the user’s interactions with a

  • 0

I am trying to build a system the remembers the user’s interactions with a website, for example my site allows the users to build their own navigation system, but I want the system to be able to remember the navigation’s system they choose without the user having to sign up, I assume I need to use sessions/cookies for these, and further I would assume I would need to use cookies as they don’t expire when the browser closes (I know they expire after a period of time).

So I have set up using the codeigniter session library and have the session ids saving to the database. What I need to know is how can using sessions and cookies save the user navigation choice, for example if the user chooses to user the blog navigation then I need to be able save that so next time they come to the site, the blog navigation is used. Could someone please point me in the right direction? Please don’t point me at the manual. I have tried the cookie helper and whatever I try, the cookie will not set.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:20:00+00:00Added an answer on May 13, 2026 at 1:20 pm

    I know you asked not to be pointed at the manual but it really will give you the answers. You shouldn’t need to interact directly with a cookie to do what you want to do, sessions handle this for you. So long as you are not saving any sensitive data, you can leave the session settings at their default which will save the session data to a cookie on the user’s machine but you will want to make a small adjustment to ensure the timeout is extended.

    So first things first, read: Session Class : CodeIgniter User Guide

    Then you can load the session library:

    $this->load->library("session");
    

    And save data to the session:

    $this->session->set_userdata("navigation_choice_a", "navigation_value_a");
    

    Then read it out later using:

    $this->session->userdata("navigation_choice_a"); 
    // Will return "navigation_value_a"
    

    You can also save numbers, classes and arrays to the session and they will reconstruct again when reading the data.

    One last thing, to ensure that the session doesn’t expire after two hours, in your config, change the line with $config['sess_expiration'] to be:

    $config['sess_expiration'] = 0;
    

    This will ensure the session does not expire.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to build my own user authentication system (simply because the ones
I am trying to build a system of monitoring site / server uptime in
We are trying to build a Help Desk ticketing system just for intranet. Deciding
I'm trying to build a Windows installer using Nullsoft Install System that requires installation
We are trying to build a High-Volume Orders Record System. There are three primary
Using PHP and MySQL, I have a forum system I'm trying to build. What
I'm currently trying to build a personal website to create a presence on the
I am trying to build an website for my college's magazine. I used the
I am trying to build a system that will be able to process a
I've been tasked to build a system that allows someone in our company to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.