I know this question is already on the questions list. I tried everyone's answer but it is not helping me a little bit. The header function is working fine on localhost but when I upload the files to the server the header line is not working. I am tired of doing changes again and again. I need your help. Please!
<?php
session_start();
$name = $_POST['Username'];
$pass = $_POST['Password'];
if(isset($_POST['Submit'])){
if((isset($name) && isset($pass))){
include 'connection.php';
$sql = "select * from `users` where username='$name' AND password='$pass' ";
$result = mysqli_query($conn, $sql);
if(mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_assoc($result)) {
$_SESSION['login_user'] = $row["username"];
$_SESSION['login_user_pass'] = $row["password"];
header('Location: ../php/businesshome.php'); // Redirecting To Other Page
}
}
else {
$error = "Username or Password is invalid";
}
}
}
mysqli_close($conn);
?>