I have a form validator in my formhandler
<?php
include("include/session.php");
if(isset($_POST['submit'])){
include("connect.php");
$message = array();
//validate your form data
if (empty($_POST['firstname'])) {
$message[] = '<p>You forgot to enter your first name!</p>';
}
// Check for an second name.
if (empty($_POST['secondname'])) {
$message[] = '<p>You forgot to enter your second name</p>';
}
if (empty($_POST['organisation'])) {
$message[] = '<p>You forgot to enter your organisation</p>';
}
if(count($message) > 0){
//hold the error in session so you can display the error in your form page.
$_SESSION['message'] = $message;
//redirect to the form
header("Location: http://www.mindseyemidlands.co.uk/notts_quality/info_resource/selfassess_part1a_v1.php");
}
else {
and when the redirect takes place the errors should echo but they don't
<?php
//if form validation errors exists, list them out
if(isset($_SESSION['message']) && (count($_SESSION['message']) > 0)) {
echo '<ul>';
foreach($_SESSION['message'] as $message){
echo '<li>'.$message.'</li>';
}
echo '</ul>';
}
?>
how come the error message is not echoed?