这是我的代码....脚本标记在此PHP代码中无法进行表单验证。
$get_email = "select * from users where user_email='$email'";
$run_email = mysqli_query($con,$get_email);
$check = mysqli_num_rows($run_email);
if($check==1){
echo "<script>alert('Email is already registered!')</script>";
exit();
}
if(strlen($pass)<8){
echo "<script>alert('password should be 8 character!')</script>";
exit();
}
答案 0 :(得分:0)
<?php
echo "<script>
alert('Email is already registered!');
exit();
</script> ";
if( strlen($pass) ) {
echo "<script>alert('password should be 8 character!');
exit();
</script>"
}
else {
$insert = "insert into users
(user_name,
user_pass,
user_email,
user_id,user_country,
user_gender,
user_birthday,
user_image,user_regis ,
user_login date,status)
values ('$name',
'$pass','$email',
'$country',
'$Gender',
'$user_birthday',
'default.jpg',
'$date',
'$status',
'$posts')";
$run_insert = mysqli_query($con,$insert);
if($run_insert){
echo "<script> alert('Regisration successfull') </script>";
}
}
?>
我真的向您推荐,使用ajax调用来选择和验证电子邮件!