that's because the forms action is set to pass any existing QS varaible on submit.
add the following code just before the form tag to clear it from the QS:
<?php
if(isset($_SERVER["QUERY_STRING"])) {
    $arrQS = explode("&", $_SERVER["QUERY_STRING"]);
    foreach($arrQS as $k => $v) {
        if($v == "failed=true ") unset($arrQS[$k]);
    }
    $_SERVER["QUERY_STRING"] = implode("&", $arrQS);
}
?>

