Long string session variable
I have a page with a form including a textarea. This form processes session variables to a PHP script for verification then depending upon further user input goes to a final PHP script to complete the task of updating a MySQL database and sending out an email confirmation. How do I get the potentially lengthy text from the textarea from the original input to the intermediate script to the final task? I'm reading some about serialize(), but not sure if that's the best alternative.
Thanks in advance -
If you're going to store it in $_SESSION, there should be nothing else you need to do to it. (serialize() is just a way to store a PHP array as a string, but you already have a string.)
Just make sure each page in the form-handling sequence begins with a session_start() before anything gets output, when you receive the text from the first form page, store it as an element of $_SESSION, and when you need it in a subsequent page, grab it from there (first checking to see if it's set, of course, in case something wonky/malicious happened).
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
My question would be "what's the problem?!?" -- which is to say why isn't your validation able to call the next step directly?
Lemme guess, are you using header() to do a HTTP redirect to the next step? I don't know who out there is promoting that 'handshaking for nothing' method of doing things, but ... it's rubbish. My advice, CUT THAT OUT!
But then I usually have ONE .php file that acts as a traffic cop, handling all requests and feeding it to the proper side-streets like validation, form output and result handling. This makes it easier when validation fails as I can just call the form again directly and repopulate it from $_POST instead of screwing around trying to save the values -- or hand off to result processing to again just use the values already there.
Basically, it sounds like you're using HEADER to do INCLUDE's job... though that's a wild guess. Hard to really say without seeing any code.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread