bhavin_85 Posted April 6, 2007 Share Posted April 6, 2007 hey guys ive written this if statement and i want an alter box to appear when the wrong username and password is entered...however i also want the page to redirect the user to the login page once they click ok the to alter if($count==1){ $_SESSION['username']=$username; header("Location:default.php"); } else { echo "<script>alert('You have entered an Incorrect Username or Password')</script>"; header("Location:login.php"); } the only problem is that the echo is modifying the header so it wont redirec, i get this error : Warning: Cannot modify header information - headers already sent by (output started at /export/SOI-1/students/u2003/gy478/web/login1.php:13) in /export/SOI-1/students/u2003/gy478/web/login1.php on line 14 like 13 is the alter and line 14 is the header any ideas how i can get around this? Quote Link to comment Share on other sites More sharing options...
jitesh Posted April 6, 2007 Share Posted April 6, 2007 If you will comment this line echo "<script>alert('You have entered an Incorrect Username or Password')</script>"; Then the error will be gone. My sugession is do like this -------------------------- header("Location:login.php?login=fail"); and at login file set if($_GET['login'] == "fail"){ echo "<script>alert('You have entered an Incorrect Username or Password')</script>"; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.