Registering the form Checking two passwords

I want this registration script to inform the user when the passwords entered do not match.

and I use this code:

 if ($_POST['pass' != 'pass2'])
 {
  echo
   ("Oops! Password did not match! Try again. ");
 }

please help me fix my encoding. :-( Thank you very much!

+3
source share
5 answers

You cannot reference both variables inside the same $ _POST

if ($_POST['pass']!= $_POST['pass2'])
 {
     echo("Oops! Password did not match! Try again. ");
 }
+8
source
if ($_POST['pass']!= $_POST['pass2'])
 {
     echo("Oops! Password did not match! Try again. ");
 }

.. I will use this code. and it also works. :-)

.. thanks for the help.

+3
source
if ($_POST['pass'] != $_POST['pass2'])
+1

. :

if(($_POST["pass"])!=($_POST["pass2"])){
    echo"Oops! Password did not match! Try again.";
}
+1

, . .

if(trim($_POST['pass'])=='' || trim($_POST['pass2'])=='')
{
    echo('All fields are required!');
}
else if($_POST['pass'] != $_POST['pass2'])
{
    echo('Passwords do not match!');
}
0

Source: https://habr.com/ru/post/1756125/


All Articles