1

由于某种原因,我的错误验证的后半部分不起作用,除非前半部分出错。看评论。有人可以发现我的错误吗?我不想使用 if/elseif,因为如果存在多个错误,我希望在 div 中打印多个错误。

    // Validation errors        
    if ($user && ($user !== pg_fetch_result($result, 0, 'user_name'))) { 
        echo "<div id='custom'><ul><li><font color='#672330'>&#187</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'>&#187</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'>&#187</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'>&#187</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 语句中,不确定这是否会有所不同......让我知道发布整个代码是否会有所帮助。

4

0 回答 0