I have been trying to link the home.php and login.php file i created to my validation file but it is not working. It is showing Warning: include(location:login.php): failed to open stream: No such file or directory in C:\xampp\htdocs\userregistration\validation.php on line 21
<?php
session_start();
$con = mysqli_connect('localhost','root','');
mysqli_select_db($con, 'userregistration');
$name = $_POST['user'];
$pass = $_POST['password'];
$s = " select * from usertable where name = '$name' && password='pass'";
$result = mysqli_query($con, $s);
$num = mysqli_num_rows($result);
if($num == 1){
include 'location:home.php';
}else{
include 'location:login.php';
}
?>
Ok, so in the code you shared. I found a typo:
// missed $ in $pass
$s = " select * from usertable where name = '$name' && password='pass'";
Then
if ($num == 1) {
("home.php"); //<-- here try: header("location:./home.php");
} else {
("login.php"); //<-- here try: header("location:./login.php");
}