Now i've been thinking over this for a couple of days. As you guys know i needed help with sessions not to long ago. So anyway i've got my script all done but i've run into something else. POSTDATA.
Lets say my script works like this:
// form stuff
// if request[action] is equal to Step 2 get the post data
Now if someone wants to go back or wants to refresh i hate when it comes up saying the POSTDATA message. So i'm thinking is there another way to transfer form data to a new page so that if that person refreshes or goes back it doesn't pop up with that POSTDATA notice.
I read an article that PHP SESSIONS is the way to go if you don't want it appearing. So instead of my current script layout i'd have this:
// form stuff
// if submitted post the form data and create a session for each, then use Header location or meta refresh to go to Step 2
// Step 2 if i refresh or go back the pop-up shouldn't appear.
Now i ask you guys the question is PHP SESSIONS really the best way to handle multiple form data pages?
Or is there another way?
I was actually thinking about storing form data into an XML file and then grabbing data from the file when needed however i'm not sure that is the best option. Or maybe AJAX is a good solution.
Either way i'm looking for some ideas and theories on the best ways to send multiple forms of data across several pages.
Now if someone wants to go back or wants to refresh i hate when it comes up saying the POSTDATA message. So i'm thinking is there another way to transfer form data to a new page so that if that person refreshes or goes back it doesn't pop up with that POSTDATA notice.
I read up to their and stopped. Yes there is.
Just do a redirect after the POST data has been sent and pass a GET variable to show a confirmation message.
Thanks for that, I normally have the same problem with POST and never thought of redirecting to the same page, seems pretty obvious when you think of it
The other way is to show a page after the post and use that page to redirect after X seconds. it's how IPB and other forums do it... but i don't like that method
No there is not a maximum amount of sessions. The maximum character limit is what ever the maximum length of a filename on your OS. Since each session is actually the name of a file on your system.
if you have a problem with enough 'room' in sessions then ive heard serialize() is a good function to use..not actually used it or know what it does so maybe VBAassassin can give a little insite there :)
Na you don't need serialize for that. Serialize converts pretty much anything in PHP that has already been constructucted such as an object or array.... and converts it to text form which can then be stored in a file for example without losing any structure or information. Then it can be unserialized and restored at a later date.
So basically i can use this serialize function to save stuff into a file. And then later on in my script i can call it up again. That's cool.
*Starting to think i should have used more of that*
Just a thought, so this is similar to the fwrite and fopen functions when fopen is in write mode?
Which would you prefer for lets saying having to store some data and then3 pages ahead you need that data again. The bad thing is that the data is too large to be carried in a Session and POST won't work.
How would you approach it, Serialize or file reading?
You do not have permission to post replies to topics in this board. If you want to join in with discussions and create new topics please register. If you want to register your own free account with us, please click here.
Not enough time to do something productive I run out of ideas Too hard to show people my creations Everything i do has too many errors, and it's too hard I don't get bored!!!
please login to cast your vote and see the results of this poll