Re: Session Variable Problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks again for all the help, however the plot thickens.

I have put:

<?php if(!isset($_SESSION)) {
    session_start();
 }
 if (isset($_POST['lend_fname'])){
$_SESSION['lend_fname']=stripslashes($_POST['lend_fname']);
}
if (isset($_POST['lend_lname'])){
$_SESSION['lend_lname']=stripslashes($_POST['lend_lname']);
}
if (isset($_POST['lend_street'])){
$_SESSION['lend_street']=stripslashes($_POST['lend_street']);
}
if (isset($_POST['lend_city'])){
$_SESSION['lend_city']=stripslashes($_POST['lend_city']);
}
if (isset($_POST['lend_state'])){
$_SESSION['lend_state']=stripslashes($_POST['lend_state']);
}
if (isset($_POST['lend_lname'])){
$_SESSION['lend_zip']=stripslashes($_POST['lend_zip']);
}
if (isset($_POST['lend_email'])){
$_SESSION['lend_email']=stripslashes($_POST['lend_email']);
}
if (isset($_POST['lend_phone'])){
$_SESSION['lend_phone']=stripslashes($_POST['lend_phone']);
}

?>

On the first page, Now what happens is it only sticks to the first two 
(lend_fname and lend_lname), the others still get lost. Any idea how or why 
the exact code works differently?

Thanks Again.

gary




"tedd" <tedd.sperling@xxxxxxxxx> wrote in message 
news:p06240800c7cbc092762b@[192.168.1.102]...
> At 2:22 PM -0400 3/20/10, Gary 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
>
> Gary:
>
> I think I know what the problem is. When you revisit previous pages, you 
> write over the previous data from an empty $_POST. Here's a way to stop 
> that.
>
> <?php session_start();
>
> if (isset($_POST ['lend_fname'])
>   {
>   $_SESSION['lend_fname'] = $_POST['lend_fname'];
>   }
>
> As far as using strip_slashes() and htmlentities() I wait until I am going 
> to use the variables in some manner and then clean/scrub them all at one 
> time. That makes the process simpler for me -- plus I can then keep all my 
> security checks in one location.
>
> Cheers,
>
> tedd
>
> -- 
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> __________ Information from ESET Smart Security, version of virus 
> signature database 4962 (20100321) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
> 



__________ Information from ESET Smart Security, version of virus signature database 4962 (20100321) __________

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux