第一行错误未定义索引:$ pwd 还有未定义的变量。 请显示新代码谢谢! 它的结尾吐出来了。
$pwd = $_POST['$pwd']; //Error undefined index: $pwd
if( strlen($pwd) < 8 ) {
$error .= "Password too short!
";
} //This line undefined variable
在此处获取错误******错误变量
if( strlen($pwd) > 20 ) {
$error .= "Password too long!
";
}
if( strlen($pwd) < 8 ) {
$error .= "Password too short!
";
}
if( !preg_match("#[0-9]+#", $pwd) ) {
$error .= "Password must include at least one number!
";
}
if( !preg_match("#[a-z]+#", $pwd) ) {
$error .= "Password must include at least one letter!
";
}
if( !preg_match("#[A-Z]+#", $pwd) ) {
$error .= "Password must include at least one CAPS!
";
}
if( !preg_match("#\W+#", $pwd) ) {
$error .= "Password must include at least one symbol!
";
}
if($error){
echo "Password validation failure(your choice is weak): $error";
} else {
echo "Your password is strong.";
}
再次感谢:D
答案 0 :(得分:0)
而不是$pwd = $_POST['$pwd'];
使用$pwd = $_POST['pwd'];
答案 1 :(得分:0)
$ pwd = $ _POST ['$ pwd'];
我想这应该是:
$ pwd = $ _POST ['pwd'];
但这取决于密码字段在表单中的名称。如果表单上的密码字段名称是password,则将其设为$ _POST ['password']
答案 2 :(得分:0)
如果你有......
<input type="password" name="pwd">
然后在你的php脚本中,你应该调用它
$pwd = $_POST["pwd"];
记下name属性。