[code] <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="shortcut icon" href="" /> </head> <body> <table width="100%" border="0"> <tr> <td><div align="left"><img src="images/myDesiBook_new_2.jpg" width="481" height="100"></div></td> </tr> </table> <table width="100%" border="1"> <td width="50%"> </td> <td width="50%"> <form action="authenticate.php" method="post" name="login" id="login"> <p align="left"><em><strong>Please login using your account</strong></em></p> <p>Username: <input type="text" name="username"> <br> Password: <input type="password" name="password"> <br> <input type="submit" value="Login"> <br> If new user please <a href="register.php">Register</a>. </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </form> </td> </table> </body> </html> [/code] [code] <html> <head> <title>Library | Login </title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php $db = mysql_connect("localhost", "root", "apurva"); if (!$db) { die('Could not connect: ' . mysql_error()); } else { //echo 'Connected successfully'; } mysql_select_db("sharelib",$db); $varUser = $_POST["username"]; $varPass = $_POST["password"]; $result = mysql_query("SELECT * FROM user_table where email = '".$varUser."' and password =PASSWORD('".$varPass."')",$db); if($result) { if($myrow = mysql_fetch_row($result)) { print "Authenticated Successfully"; //$URL="http://localhost/MyLibrary/home.php"; //header ('Location: $URL'); //header ('Location: http://localhost/MyLibrary/home.php'); } else { // print "you dont exist"; //Trying to redirect to Login Page print "Authentication Failure"; $URL="http://localhost/MyLibrary/login.php"; header ("Location: $URL"); exit; } } else { print "Oooops DB Syntax Problem!!!"; } mysql_close($db); ?> </body> </html> [/code] In the above code, I am trying to authenticate the user from the userTable inside a mySQL DB. I sucessfully able to authenticate the user, but it does not redirect to the desired page after authenticating the user. For Wrong Password --> "Login.php" Correct Password --> "Home.php" Please help me.