第一行出现错误未定义索引:$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
使用$pwd = $_POST['pwd'];
而不是$pwd = $_POST['$pwd'];
$pwd=$_POST['$pwd'];
我想这应该是:
$pwd=$_POST['pwd']
但这取决于密码字段在表单中的名称。如果表单上的密码字段的名称是password,则将其设置为$_POST['password']
如果您有。。。
<input type="password" name="pwd">
然后在php脚本中,您应该将其称为
$pwd = $_POST["pwd"];
注意name属性。