I have two form pages. Once validation is complete on the first page, the user has to complete a second page. If there are no initial validation issues on the second form, the page is redirected to the first form page....exactly what I want!! However, if there is any single validation issue whatsoever on the second form, after submitting, it does not redirect...brings up the browser's expired page and when refreshed shows the original info -- even though the form has already been submitted. I have been plugging away at this all day and I'm completely stumped. I know this has to be so simple. If you need more info, I'm happy to provide it. Any help would be greatly appreciated!
I'm pretty sure the issue is on the second form:
<?php
// start session
session_start();ob_start("ob_gzhandler");
// Submitted Variables
$field_FirstName = $_POST['field_FirstName'];
$field_Street = $_POST['field_Street'];
$submit = $_POST['submit'];
// Check the token to see if they match
if($_GET['id'] == $_SESSION['id'] or isset($_POST['submit'])) {
if (isset($field_FirstName, $field_Street, $submit)) {
$errors = array();
if (strlen($field_FirstName) < 1)
$errors[0] = "Must be longer than 1 character";
if (strlen($field_Street) < 2)
$errors[1] = "Street is required";
if (empty($errors))
header('Location: ups/iphone-form-process.php?id='.$_SESSION['id'].'');
}
}
else {
header("Location: iphone-form.php");
}
?>
And here's the page I'm using to process the second form:
<?php
session_start(); ob_start("ob_gzhandler");
echo "get" . $_GET['id'];
echo "session" . $_SESSION['id'];
// Check the token to see if they match
if($_GET['id'] == $_SESSION['id']) {
header("Location: ../offerform-thanks.php");
} else {
echo "fail";
}
// Invalidate the id/token so it expires
unset($_SESSION['id']);
?>