Trying to make a login page using php following a tutorial, it's successfully logging in getting both the password and username from the database then showing echo "wrong password" and welcome for each scenario. However it doesnt redirect to my login_success.php page stays on check_login.php, heres my code for the check page:
<?php
$host="localhost";
$username="root";
$password="root";
$db_name="test";
$tbl_name="members";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count > 0){
echo "Welcome";
session_register("myusername");
session_register("mypassword");
header("location:login_success.php");
}
else {
echo "Wrong Username or Password";
}
?>
any help would be great.