Jump to content

PEAR quickform - save form state on reload?


dijona

Recommended Posts

I'm wondering if anyone has any tips for saving a form state on reload? I know it can be done with JavaScript and cookies but I've got a hierselect element (2nd dropdown is dependent on selection from 1st dropdown) that seems to throw a wrench in things. Is there something built into quickform? anyone done something like this?

Well that's not actually that helpful. I know I'm a noob and all but...

 

Well, i've managed to work out a few things, but I'm still stuck.

 

Ok, here's the thing. I've got the form in PHP. some of the values are pre-populated text fields that use session variables and variables to hold the content. i.e. (PHP is just jotted down as an example..i know there are errors)

 

snip...

$myMSG = $_SESSION['Book']." ".$_SESSION['Chapter'];

echo "<form...>";
(form stuff...)

echo"<textarea name='message'>$myMSG</textarea>";
etc...
<input type=\"submit\" value=\"Send Message\">
echo "</form>";

 

I've got some basic error-checking that validates the form. If it fails, It prompts the user to enter the missing/incorrect data. The problem is - when the form reloads, $myMSG is gone.

 

So is this because my session data is being deleted on the submit? Is there any way I can have the form reload and still keep the value in $myMSG?

 

thanks in advance!

well I'm travelling so I don't have the whole code. I really thought the sample would be more than sufficient to let people know basically what's going on. The basic question, again, is: If I populate a form field with a session variable - submit the page - everything works great. BUT, if the form fails validation and reloads so user can enter/correct data - why does the field containing the session variable data disappear, and what can I do about it?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.