看板 PHP 關於我們 聯絡資訊
簡單說明下,頁面上有兩個欄位 第一個if是判斷有沒有按下check, 第二個if是判斷欄位所輸入的字元是否少於六個字元數, (但目前一直找不出錯誤, 即使表單內的兩個欄位都超過6個字元了,還是一樣顯示"error!" ) 不知道哪裡有錯,請各位幫忙:) <html> <body> <?php echo strlen($_POST["n1"])."<br>"; echo strlen($_POST["n2"])."<br>"; echo $_POST["submit"]."<br>"; if (isset($_POST["submit"]) && $_POST["submit"]=="check") { if (strlen($_POST["n1"]< 6) && strlen($_POST["n2"] < 6)) { echo "error!"; } else { echo "OK!"; } } ?> <form method="post" action=""> Row1: <input type="text" name="n1"><br> Row2: <input type="text" name="n2"><br> <input type="Submit" name="submit" value="check"> </form> </body> </html> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 180.177.90.129 ※ 編輯: blu1121 來自: 180.177.90.129 (02/15 21:56)
wayway2004:strlen($_POST["n1"])<6 && strlen($_POST["n2"])<6 02/15 21:53
blu1121:原來是)錯邊,一直沒發現..感謝@@ 02/15 21:59