Hi there
i'm busy with a form that exist out of different steps. I made a controller for a this see below. The problem is when I go from step 1 to step 2 i put the post vars in a session. In step 2 the session works fine en displays the post vars from step 1, but when i submit form 2 the session is destroyed and i'll loose the post vars from step 1 and 2
PHP Code:<?php include_once $_SERVER['DOCUMENT_ROOT']."/php/library/functions-includer.php";
//print_r($_POST);
if(isset($_POST['formStap'])){
$formStap = $_POST['formStap'];
}
else{
$formStap = NULL;
}
switch ($formStap) {
case "1":
include_once $_SERVER['DOCUMENT_ROOT']."/php/proces/form/reserveren/proces_stap1.php";
if($nextStap == "2"){
session_start();
global $arrayStap1;
$arrayStap1 = array();
$x = 0;
foreach($_POST as $array[$x]){
$x++;
}
for($i = 0; $i <sizeof($array); $i++){
//$arrayStap1[$i] = $array[$i];
$_SESSION[$i] = $array[$i];
}
print_r($_SESSION);
include_once $_SERVER['DOCUMENT_ROOT']."/pages/reserveren/stap2/index.php";
}
else{
include_once $_SERVER['DOCUMENT_ROOT']."/pages/reserveren/stap1/index.php";
}
break;
case "2":
session_start();
include_once $_SERVER['DOCUMENT_ROOT']."/php/proces/form/reserveren/proces_stap2.php";
if($nextStap == "3"){
session_start();
global $arrayStap2;
$arrayStap2 = array();
$x = 0;
foreach($_POST as $array[$x]){
$x++;
}
for($i = 0; $i <sizeof($array); $i++){
//$arrayStap2[$i] = $array[$i];
$_SESSION[19+$i] = $array[$i];
}
print_r($_SESSION);
include_once $_SERVER['DOCUMENT_ROOT']."/pages/reserveren/stap3/index.php";
}
else{
print_r($_SESSION);
include_once $_SERVER['DOCUMENT_ROOT']."/pages/reserveren/stap2/index.php";
}
break;
case "3":
include_once $_SERVER['DOCUMENT_ROOT']."/php/proces/form/reserveren/proces_stap3.php";
if($nextStap == "4"){
global $arrayStap3;
$arrayStap3 = array();
$x = 0;
foreach($_POST as $array[$x]){
$x++;
}
for($i = 0; $i <sizeof($array); $i++){
$arrayStap3[$i] = $array[$i];
}
/*
print_r($arrayStap1);
echo "<br>";
print_r($arrayStap2);
echo "<br>";
print_r($arrayStap3);
echo "<br>";
print_r($_POST);
*/
include_once $_SERVER['DOCUMENT_ROOT']."/pages/reserveren/stap4/index.php";
}
else{
include_once $_SERVER['DOCUMENT_ROOT']."/pages/reserveren/stap3/index.php";
}
break;
case "4":
break;
default: include_once $_SERVER['DOCUMENT_ROOT']."/pages/reserveren/stap1/index.php";
}
?>




Bookmarks