Welcome Guest, Not a member yet? Register   Sign In
session data loss in codeigniter
#3

There is a solution to every problem.

It is hard to say where your problem lays but it is probably the use of the back button. The back button can be problematic if your page has not been designed with this in mind. I have, in the past, had similar issues, but now I have learned to keep the back button in mind.

For example, how are you identifying which stage of the 3-stage process your user is in? Do you have a step in the link, eg:www.mydomain.com/controller/method/step-1 or are you using different methods, but assuming in your method (wrongly) that data is available? Are you using an identifier to check for fresh information or resent information (such as a hidden form field that should be incrementing).

The usual solution for me, if I have understood you correctly, is to use the same method in the stages and to identify the stage we are on from a hidden field or url variable. The intermediate data from the steps can be stored in a table or in a cookie (whichever makes more sense in you case). Your method should be written so that the back button and subsequent re-submission of a stage does not presume the existence of any info. So if, for example, you submit stage 2 data, but stage 1 data is missing, you need to represent the stage 1 form with a user message if required.

For me, with e-commerce sites that confirm an order before submission to payment processor, the data from the order is already written to a table, and confirm just re-reads it all. If they have used the back button to get back to that page and try resubmitting, the row has been identified as already submitted, and so I can deal with that user error appropriately.

The back button may, or may not, reload the page from the server. It might just reload it from local cache. That is why the back button is a pain.

The best way to do this, IMHO, is with Ajax. That way the back button can not interfere with the page process.

I hope something here helps. If not, try to isolate the issue by creating a test page and simplifying the code until the core of the issue can be easily represented. Then post the code here and I am sure someone will be able to spot the problem for you.

Best wishes,

Paul.
Reply


Messages In This Thread
session data loss in codeigniter - by neenz - 01-03-2016, 05:06 AM
RE: session data loss in codeigniter - by neenz - 01-04-2016, 11:38 PM
RE: session data loss in codeigniter - by PaulD - 01-05-2016, 05:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB