I have read so many pages and am stuck on this for the past three hours now because it just won't work.
I keep getting Notice: Undefined index: firstname
here is the bulk of the segment that isn't working:
$errMsg = "";
function sanitise($data){
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    return $data;
}
if (isset($_POST["firstname"]))
{
    $firstname = $_POST["firstname"];
    $firstname = sanitise($firstname);
    if (!preg_match("/^[A-Za-z \-]+$/",$firstname))
    {
        $errMsg .= "First name must contain only letters or hyphens.<br/>";
    }
    if (strlen($firstname) > 40)
    {
        $errMsg .= "First name cannot be over 40 characters long.<br/>";
    }
} else {
    $errMsg .= "First name cannot be empty.<br/>";
    $firstname = "";
}
    if ($errMsg != "")
    {
    header("Location: fix_order.php?firstname=$firstname");
    }
this is the code on fix_order.php where I want to access the variables.
$firstname = $_GET["firstname"];
echo "<p>firstname is $firstname .</p>";
I have tested the $firstname on the first page and it echo's the values just fine.
 
     
     
    