-3

i am trying to make a website using php with mysql database.. here is my code

<?php
$con=mysql_connect("localhost", "root", "");
mysql_select_db("mydatabase", $con);
$query = "INSERT INTO tblSecurity Values('".$_POST['txtUser']."','".$_POST['txtPass']."')";
$password = $_POST['txtPass'];
$confirm = $_POST['txtPassConfrm'];
mysql_query($query, $con);
if($password = $confirm)
{

Header("Location: Login.php");
}
else
{
echo"Verify your Answer";
}
?>

the problem is, how can i verify if the confirm password is same with the password inputted, this code works but it wont move to ELSE even the passwords are not the same. can anyone help me correct this please.. thanks

Pedro Lobito
  • 94,083
  • 31
  • 258
  • 268
Al Omar
  • 21
  • 1
  • 4

1 Answers1

1

better practice is check two passwords are same in inputting stage. here also code is correct , only mistake is php needs == instead of =.

Dinak lal V
  • 71
  • 1
  • 9