I'm making a registration form but I can't get the "Confirm Password" field to validate. The field "Password" validates but "Confirm Password" doesn't.
MY PHP code:
$ps_m="";
$ps1_m="";
$pass=isset($_POST["pass"]) ? $_POST["pass"]: "" ;
$pass1=isset($_POST["pass_1"]) ? $_POST["pass_1"] : "";
if(isset($_POST["submit"])){
if($pass===""){$ps_m="<span class=\"error\">Please enter Password</span>";}
if(!$pass1===$pass){$ps1_m="<span class=\"error\">Password does not match</span>";}
}
And Here is my HTML code:
<input type="password" name="pass" placeholder="Enter Password"/><?php echo $ps_m;?>
<input type="password" name="pass_1" placeholder="Confirm Password"/><?php echo $ps1_m;?>
Use this
$ps_m="";
$ps1_m="";
$pass=isset($_POST["pass"]) ? $_POST["pass"]: "" ;
$pass1=isset($_POST["pass_1"]) ? $_POST["pass_1"] : "";
if(isset($_POST["submit"])){
if($pass===""){$ps_m="<span class=\"error\">Please enter Password</span>";}
if($pass1!==$pass){$ps1_m="<span class=\"error\">Password does not match</span>";}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.