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

  • SEARCH
  • Home
  • 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 8434177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:35:11+00:00 2026-06-10T06:35:11+00:00

Hi Guys so i am developing an app in Codeignitor. content is updated based

  • 0

Hi Guys so i am developing an app in Codeignitor. content is updated based on three select tags. First one city which populates locality select tag for that city and at the same time makes category select tag visible.
Have successfully setup for bunch of ajax calls. content is updated according to the ajax call. Now I click on the content link to view the content. success… but when i hit back button of the browser I get messed up select tags.
So then I realized that I need a session variable so that when user hits back button of browser I can keep him at the same select tag stage. I am able to successfully store the session lets say city for the moment.
then I used

$(document).ready(function () {
            $city="<?php echo $this->session->userdata('city'); ?>";
            alert($city);
        });

to check if everything is ok or not. Now the problem is that
Los Angeles(LA):1
London:2

scenario 1:
I select LA then look at loaded content click to view the content then hit back button of browser then get blank alert box. But if i reload then I get alert with 1 in it

scenario 2 after scenario 1:
I select LA then London view content then come back and I see 1 in alert box. I reload the page i see 2 in alertbox
So I dug into this linkand found the cause of the problem… looks like refreshed session is only served on the next server request. AS you can see my problem i want that refreshed info so that i can keep my users at the same state where they left off.

Any suggestions on how I can solve this problem?

  • 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-06-10T06:35:13+00:00Added an answer on June 10, 2026 at 6:35 am

    That is how cookies work. The are send with the request from the clientside.

    A workaround is to set the $_COOKIE variable manually:

    setcookie('yourcookie', 'something', time()+3600, '/', 'http://example.com', false, true);
    $_COOKIE['yourcookie'] = 'something';
    
    // yay I can now access it right away
    echo $_COOKIE['yourcookie'];
    

    UPDATE

    Now that I think I misunderstood your question. It looks like you are having an issue when using the browsers back button? Is that correct? If so you will always get the previous state of the page and the cookie will indeed not be set (because it will retrieve it from the browsers cache). The only way I see this will ever work is either by refreshing the page through some script (i.e. JS), but that will be annoying. Or retrieve the cookie value through an AJAX call (new request) to the server.

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

Sidebar

Related Questions

Ok guys I am developing an iPhone app I have a Model class which
guys. I'm developing iphone app. so, I want to read database of iphone calendar.
i am developing a app which contains feature like default photo browser in iphone.
I'm developing a Facebook app which allow my users to draw their wanted path
Hello, everybody. We are developing an iPhone app which supported by a server-side that
Greetings, I'm working with some guys who are developing an app with Update Panels.
Cheers, I am currently developing my first app featuring In App Purchases. Everything is
I am developing a app in android .... which need a code snippet to
Greetings, I am developing a web app. One piece of it will allow users
hey guys here at stackoverflow.com I'm a student and developing a small todo app

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.