Here is my code
Code: Select all
session_start();
session_register ("sessionerrors");
$sessionerrors = '';
$validationfailed ='N';
if(empty($HTTP_POST_VARS['name'])){
$sessionerrors .= 'Name is blank <br>';
$validationfailed ='Y';
}
if(!isset($HTTP_POST_VARS['termsconfirm']) ){
$sessionerrors .= 'You must check the terms of Use Checkbox<br>';
$validationfailed ='Y';
}
if(empty($HTTP_POST_VARS['emailaddy'])){
$sessionerrors .= 'Email is blank <br>';
$validationfailed ='Y';
}
if(empty($HTTP_POST_VARS['emailconfirm'])){
$sessionerrors .= 'Confirm Email is blank <br>';
$validationfailed ='Y';
}
if(!check_email_address($HTTP_POST_VARS['emailaddy'])) {
$sessionerrors .= 'Invalid Email address <br>';
$validationfailed ='Y';
}
if(!check_email_address($HTTP_POST_VARS['emailconfirm'])) {
$sessionerrors .= 'Confirm Email address <br>';
$validationfailed ='Y';
}
if($HTTP_POST_VARS['emailconfirm'] != $HTTP_POST_VARS['emailaddy']){
$sessionerrors .= 'Emails do not match <br>';
$validationfailed ='Y';
}
if(empty($HTTP_POST_VARS['password'])){
$sessionerrors .= 'Password is blank <br>';
$validationfailed ='Y';
}
if(empty($HTTP_POST_VARS['passwordconfirm'])){
$sessionerrors .= 'Verify Password is blank <br>';
$validationfailed ='Y';
}
if($HTTP_POST_VARS['passwordconfirm'] != $HTTP_POST_VARS['password']){
$sessionerrors .= 'Passwords do not match <br>';
$validationfailed ='Y';
}
//echo $sessionerrors;
if ($validationfailed =='Y'){
header('Location: ../error_outside.php');
}
........If the user enters a value in the name field then they are not sent to the outside_error page and the processing continues as if there was not any errors.
Now at the end of the code I have the echo currently commented out but if I display that two things happen. One is it displays all of the messages within sessionerrors and the next is I see an error message that tells me there is an error with the header because of the program already sent output to the display (which I would expect because of the echo) but why doesnt the program see the value of 'Y' in validationfailed unless I put that echo there.
Any help would be greatly appreciated.