if(mysql_num_rows($sql)==1){ session_register("myusername"); session_register("mypassword"); echo "<script type='text/javascript'> <!-- window.location = 'login_success.php' //--> </script>"; } else { echo "Wrong Username or Password"; }