I'm using XAMPP for mySQL and Apache web server. The database seems to be connected but when I try to login after creating an entry for username and password on the db. it says fail to login.
<form action ="process.php" method ="POST">
<p><label>Username:</label>
<input type="text" id="user" name="username"/>
</p>
<p><label>PassWord</label>
<input type="password" id="pass" name="password"/>
</p>
<p>
<input type="submit" id="btn" value="Login"/>
</p>
</form>
This is my process.php
<body>
<?php
$username =$_POST['username'];
$password =$_POST['password'];
$connectionString = mysqli_connect('localhost', 'root','', 'a7');
$result=mysqli_query($connectionString, "select * from table1 where
username = '$username' and password ='$password'") or die("failed to
find db ".mysql_error());
if($row['username']==$username && $row['password']==$password){
echo "success welcome ".$row['username'];
}
else{
echo "failed login";
}
?>
It always comes up:
Notice: Undefined variable: row in C:\xampp\htdocs\assignment7b\process.php on line 30 failed login
Line 30 : if($row['username']==$username && $row['password']==$password)