On Sat, Mar 20, 2010 at 2:22 PM, Gary <gwp...@ptd.net> wrote:

> I have this perplexing issue of session varibles getting dropped.  It is a
> 4
> page form, the last page being a review page incase the submitter wants to
> change any of the information.If you go through the form, all of the
> information carries forward, and from the review page if you go back to
> edit, it is there, however is you go back to page 2, then to page 1, page
> one info is gone.It gets worse in that page 2 sessions drop (more likely
> over written) if you go from page 3 to 2.
>
> Each page is started with
>
> <?php if(!isset($_SESSION)) {
>    session_start();
>  }
>
> Session varible:
>
> $_SESSION['lend_fname']=stripslashes($_POST['lend_fname']);
>
> Calling the session varible to the input field for review
>
> <?php if (isset($_SESSION['lend_fname'])) {echo
> 'value="'.htmlentities($_SESSION['lend_fname']).'"';}?>
>
> The page starts at http://www.paulgdesigns.com/one2one/lend_bor_input.php
>
> Im confused as to why they keep getting dropped and how to stop it.
>
> Hopefully I have given enough information.
>
> Thank you
>
> Gary
>
>
>
> __________ Information from ESET Smart Security, version of virus signature
> database 4961 (20100320) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Are you checking to see if the post variable is set in the code that handles
saving the form values to session variables?  I can't tell if you're doing
this from the code you provided.  If not, it's possible that when you are
returning to one of the earlier pages, you're attempting to again save the
form values even though the corresponding $_POST vars are empty.  This would
cause visiting page 2 to essentially delete the data previously posted from
page 1.

Using your example:

// Only save if post variable present, which means
if (isset($_POST['lend_fname']))
{
    $_SESSION['lend_fname']=stripslashes($_POST['lend_fname']);
}

Also, some users will likely click the back button during the process, which
brings up a funky message.  You might try building one page that is
dedicated to saving all of the session variables, which then redirects to
the corresponding next page in the process.

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com

Reply via email to