I have a little problem. I have a login box with a submit button, but I can't redirect to another page. I insert the email and password but it doesn't works, it just stay on the first page. What can I do?
I use this:
header("Location: home.php");
Here is my code:
<?php session_start();
include_once 'dbconnect.php';
if(isset($_SESSION['user'])!="") {
header("Location: home.php");
}
if(isset($_POST['btn-login'])) {
$email = mysql_real_escape_string($_POST['email']);
$upass = mysql_real_escape_string($_POST['pass']);
$res=mysql_query("SELECT * FROM users WHERE email='$email'");
$row=mysql_fetch_array($res);
if($row['password']==md5($upass)) {
$_SESSION['user'] = $row['user_id'];
header("Location: home.php");
} else {
?>
<script>alert('wrong details');</script>
<?php } } ?>