Image

Imageloupblanc wrote in Imagephp

maintaining state

Hello,

I'm trying to build a data submission form divided in 6 sections. The first 5 sections are basically the submissions themselves and section 6 is a preview of all the data that has been entered.

The reason why I do this is to keep each forms short and within their own context. Now the reason why I have a preview is to allow the user to go back to one of the pages if s/he has made a mistake. I've managed to maintain the data entered by transfering each $_POST variable to its respective $_SESSION variable.

However, I can't seem to find an efficient way to make sure that the data is still there when the correction is being submitted...

The idea is that, using data maintained in the cache, I can go back to the form that needs to be corrected and the input would still be there. So for instance re-reading the whole of the input data from the preview, a mistake made on section 2 needs to be corrected, I have a link at the top with basically something like Javascript:history.go(-4) and the data would still be there since I'm using the session_cache_limiter() as public. However, on submission the data on section 3 is now lost and I would like it to still be there, but I'm not sure how.
Perhaps using a isset() for each field of each form would work with retrieving the info held in the session but that means my php file will double in size (the 6 sections are all in one php page). I don't want to rely on cookies as it's not the most efficient way to make sure data can be retrieved (people can disable cookies) and I don't know an awful lot about JavaScript.

So if anyone has suggestions, I'd be glad to hear them. I'm not posting the code here because it's about 300 lines of code and I don't want to clog the bandwidth. I can post the code as a text file somewhere on line if you're really interested though.

Thanks for the help, hopefully I was clear enough.