Why doesn't this PHP program work.?

John Kelly

New member
I made a PHP program for validating password and username and if it is correct then to writ WELCOME. But unluckily even if i give wrong password and name then also it writes WELCOME. Please figure out the problem. I will be thankful to you.

<html>
<title> Prove Your Identity</title>
<font face="Comic Sans MS","Arial" >
<font color= "red">
<h1> Welcome to password validator</h1>
<form action='validate.php' method='POST'>
Username:<br>
<input type="text" name="username"> <p>
Password:<br>
<input type="password" name="password"><p>
<input type='submit' value='submit' name='submit'>
</form>

<?php
if ($_POST['submit'])
{
$username=$_POST['username'];
$password=$_POST['password'];
$validator='Welcome John';
if ($username='John' && $password='1234')
echo "$validator";
else
{
die("unsuccessful");
}
}
?>
</html>
 
Back
Top