I have two files:
The first one is a php file called index.php - which is visible to the user and contains an HTML form.
<?php
ob_start();
session_start();
?>
<form method="post" action="create_profile.php">
....
<input id="personal_email" name="personal_email" tabindex="auto" type="text" />
....
<input name="submit" type="submit" value="Submit">
</form>
<?php
//Get value from create_profile.php
if(empty($_POST) === false) {
$invalidEmail = $_SESSION['invalidEmail'];
echo $invalidEmail;
}
?>
The second file create_profile.php process the above file index.php, basically it checks the form and sees if there are any errors - if there are any errors it is suppose to display errors in index.php
<?php
....
if (filter_var($personal_email, FILTER_VALIDATE_EMAIL)) {
$invalidEmail = 'The email address is invalid or missing' . '<br/>';
}
...
//Send errors to index.php
$_SESSION['invalidEmail'] = $invalidEmail;
header('Location: create_profile.php');
..
?>
The problem is that when I submit the form from index.php to create_profile.php - the error from create_profile.php is not being display in index.php
I am not getting any errors in my error log!