出于某种原因,我的错误验证的后半部分无效,除非上半部分错误。看评论。有人可以发现我的错误吗?我不想使用if / elseif,因为如果存在div,我希望在div中打印多个错误。
// Validation errors
if ($user && ($user !== pg_fetch_result($result, 0, 'user_name'))) {
echo "<div id='custom'><ul><li><font color='#672330'>»</font> The username you entered is invalid.
<div id='noteii'>Please go back and re-enter your current username or contact your account representative for assistance.</div></li></ul></div>";
}
if ($pass && ($pass !== pg_fetch_result($result, 0, 'user_pass'))) {
echo "<div id='custom'><ul><li><font color='#672330'>»</font> The password you entered is invalid.
<div id='noteii'>Please go back and re-enter your current password or contact your account representative for assistance.</div></li></ul></div>";
}
// Now, if the all of the above are error free the next lines don't work?!...But, the next lines do work if either of the above show errors?! :|
// Validate password(s)
if ((strlen($newpass) < 5) || (strlen($newpass) > 15)) {
echo "<div id='custom'><ul><li><font color='#672330'>»</font> The new password you entered is invalid (Password must be 5 to 15 characters, CaSe SeNsItIvE).
<div id='noteii'>Please go back and re-enter your desired password(s) password or contact your account representative for assistance.</div></li></ul></div>";
}
if ($newpass !== $cfmpass) {
echo "<div id='custom'><ul><li><font color='#672330'>»</font> The passwords you entered do not match.
<div id='noteii'>Please go back and re-enter your desired password(s) or contact your account representative for assistance.</div></li></ul></div>";
}
//
编辑:这段代码实际上包含在父ELSEIF语句中,不确定是否会产生影响......如果发布整个代码会有所帮助,请告诉我。