Page 1 of 1

preserve value of session

Posted: Tue Jul 22, 2008 9:43 pm
by junjustkim
I have a lot of textboxes, check boxes in my form and I got already all the values using session. This form containing 4 pages. In my first page after the user fill up the form then go to the succeeding pages. In every pages I want to preserve the values of the form in array so that I can retrieve the values and display it after completion of all the forms.

The code below putting the values in array but when I call this array to display the value after the completion of the form, it was result nothing.

Please help me and advice. I am a newbie with this environment.

Thanks in advance

Code: Select all

<?
session_start();
$arval = array();
require_once("../include/session.php");
reset ($_POST);
while(list($key, $val) = each ($_POST))
    {
        if ($val == "") 
          $val = "NULL";
        $arVals[$key] = (get_magic_quotes_gpc()) ? $val : addslashes($val);
     }
?>
session.php

Code: Select all

$arVals = array("monthdatebenifit"=>"", "daydatebenifit"=>"", "yeardatebenifit"=>"");

Re: preserve value of session

Posted: Wed Jul 23, 2008 11:51 am
by mabwi
Try adding this:

Code: Select all

 
 
$_SESSION['arval'] = $arval;
 
 
After you set the value of the array. To retrieve it:

Code: Select all

 
$arval = $_SESSION['arval'];