Should this page validate?
I have set two fields on my page to be validated if alphanumeric, required and not blank.
The generated code is as follows or very similar for both fields with only the numbers changing:
<?php
if (isset($_POST["Insert "])) {
$WAFV_Redirect = "eventinsert.php";
$_SESSION['WAVT_eventinsert_469_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateAN(((isset($_POST["club_organiser"]))?$_POST["club_organiser"]:"") . "",true,true,true,true,"",true,3);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["club_organiser"]))?$_POST["club_organiser"]:"") . "",true,1);
if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"eventinsert_469");
}
}
?>
In addition they are both set to show the word "Required" if not validated, and the code is as follows:
<input name="club_organiser" type="text" id="club_organiser" tabindex="1" size="64" maxlength="128"> </td><td class="warning"><?php
if (ValidatedField('eventinsert_469','eventinsert_469')) {
if ((strpos((",".ValidatedField("eventinsert_469","eventinsert_469").","), "," . "1" . ",") !== false || "1" == "")) {
if (!(false)) {
?>
Required
<?php //WAFV_Conditional eventinsert.php eventinsert_469(1:)
}
}
}?></td>
I think that this code should only validate the fields if
1: They are alphanumeric
2: They have content that is not blank
If they do not validate, the page should be refreshed with the words "Required" displayed.
What actually happens is that the fields pass validation regardless of whether they have any content or not, and an invalid empty or partly completed entry is made in my database.
Additionally the " show if " validation fields on them, do not appear to work as expected. They do not show when the form is submitted in any circumstances.
Can anyone tell me what is wrong with the code?
Or am I not applying the behaviours correctly?