Server Validations losing $_POST values and
Couple questions on Server Validations
1) Is there a reason $_POST values are lost on submission?
The server validation works and displays the missing input value but the $_POST is not retained which requires a filling out the form again.
if ($_SERVER["REQUEST_METHOD"] === "POST") {
$WAFV_Redirect = "rates-and-availabilityx.php";
$_SESSION['WAVT_ratesandavailabilityx_517_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ(((isset($_POST["contact-name"]))?$_POST["contact-name"]:"") . "",false,1);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["email"]))?$_POST["email"]:"") . "",false,2);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["dateArrive"]))?$_POST["dateArrive"]:"") . "",false,3);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["dateDepart"]))?$_POST["dateDepart"]:"") . "",false,4);
if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"ratesandavailabilityx_517");
}
}
<input name="contact-name" type="text" class="form-control order-1"
value="<?php if (isset($_POST['contact-name'])) {
echo $_POST['contact-name'];
} ?>"/>
2) Is there a variable that is present that we can use to show an area (or not) IF there are any outstanding server validations still present?
Looking at the generated code it looks like this is the case to use:
<?php if (isset($WAFV_Errors) && $WAFV_Errors != "") { ?>
Just looking for a confirmation that this is the best practice method for a generic conditional showing of a wrapper div.