nickg21
01-08-2007, 06:48 PM
hey everyone, i am using a session to pass the information from 6 different forms into a validation. the validation occurs after every individual form is processed so the user can't go to the next section unless the previous is accurate. the only problem i am having is that after my form validates and returns to the page when an error is found, the session variables are reset, but when they are correct they remain intact. below is my code, does anyone have any idea how i can get around this....? thanks in advance
headerImage.php-- Main page where the forms load:
<?php
session_start();
header("Cache-control: private");
foreach($_POST as $key => $var) {
$_SESSION[$key] = $var;
}
?>
<?php
IF (!isset($_POST['step'])) {
include "ListInfo.php";}
ELSEIF ($_POST['step'] == 2){
include "OptServices.php";}
ELSEIF ($_POST['step'] == 3){
include "ContInfo.php";}
ELSEIF ($_POST['step'] == 4){
include "BillInfo.php";}
ELSEIF ($_POST['step'] == 5){
include "Survey.php";}
ELSEIF ($_POST['step'] == 6){
include "Terms.php";}
print_r($_SESSION)
?>
---Part of the validation code--- Only for ListInfo.php
if(empty($SendAddr)){
$error[] = "";
$SendAddr="";
}
if(count($error) > 0){
header('Location: headerImage.php');
echo "<input type='hidden' value='' name='step'>";
echo "Please Correct Your Errors Before Proceeding";
}ELSE{
include_once('headerImage.php');
}
}
headerImage.php-- Main page where the forms load:
<?php
session_start();
header("Cache-control: private");
foreach($_POST as $key => $var) {
$_SESSION[$key] = $var;
}
?>
<?php
IF (!isset($_POST['step'])) {
include "ListInfo.php";}
ELSEIF ($_POST['step'] == 2){
include "OptServices.php";}
ELSEIF ($_POST['step'] == 3){
include "ContInfo.php";}
ELSEIF ($_POST['step'] == 4){
include "BillInfo.php";}
ELSEIF ($_POST['step'] == 5){
include "Survey.php";}
ELSEIF ($_POST['step'] == 6){
include "Terms.php";}
print_r($_SESSION)
?>
---Part of the validation code--- Only for ListInfo.php
if(empty($SendAddr)){
$error[] = "";
$SendAddr="";
}
if(count($error) > 0){
header('Location: headerImage.php');
echo "<input type='hidden' value='' name='step'>";
echo "Please Correct Your Errors Before Proceeding";
}ELSE{
include_once('headerImage.php');
}
}