<?php
session_start();
if (isset($_POST["user_name"]) && isset($_POST["user_pwd"])) {
include"php/connect_to_mysql.php";
$user_name = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["user_name"]);
$user_pwd = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["user_pwd"]);
$sql = "SELECT * FROM user_ac WHERE user='$user_name' OR email='$user_name' AND pwd='$user_pwd' LIMIT 1";
$result = mysqli_query($myConnection, $sql);
if (mysqli_num_rows($result) > 0) {
echo "Successfully Logged In";
header("location: login.html?abc=234");
} else {
}
} else {
}
In this code, inside the second if
statement, echo
is not displaying anything, but the header
function executes correctly.
Please help, thanks.
You cannot see the echo because you are going to another page.
As test, remove the header("location: login.html?abc=234");
and you will see the echo
.
header function redirect you to new page, so your echo will appear in your current page but your code by this line:
header("location: login.html?abc=234");
will redirect you to new page.