Log in

View Full Version : form validation



nickg21
01-08-2007, 05:22 PM
hey everyone i am currently using 6 individual forms in order to gather information from a user. all of the forms have different field names and submit button names. i am looking to use a seperate validation page to validate each one individually and if errors occur to reload the page and keep the correct info displayed. I am able to keep the correct information displayed but i do not know how to make my code have the same page reload. below is my logic of these forms. hope someone can help me out a little
thank you


<?php
session_start();
header("Cache-control: private");
foreach($_POST as $key => $var) {
$_SESSION[$key] = $var;
}
?>
<?php
IF (!isset($_POST['step'])) {
include "ListInfo.php";
include "validation.php";} <-- want to include in every page possibly?
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";}
?>
and here is some of the validation.php:

if(empty($SendAddr)){
$error[] = "";
$SendAddr="";
}
if(count($error) > 0){
echo "Please Correct Your Errors Before Proceeding";
}ELSE{
include_once("HeaderImage.php");
}
everything is declared properly above and the validation is all correct this is just where i think i would need to execute the code to return me properly to headerImage.php with the page included depending upon the 'step'? hope this isn't too confusing