piyus168 Posted March 13, 2007 Share Posted March 13, 2007 hi alli am new to phpi want to make a page that can transfer me to another page using some conditioni have created one textbox named id on page test1.phpand if i enter 1 in that then i should be on page test2.php otherwise on test1.phphere is my code //------------------------------------------------ $id = $_POST['id']; if ($id == 1) { header("Location : test2.php"); } else { header("Location : test1.php"); }//-----------------------------------------------if i use this i got te error : "Warning: Cannot modify header information - headers already sent by (output started at c:\wamp\www\test\test2.php:7) in c:\wamp\www\test\test2.php" !if there is any other alternative to do this... which function can i use for this application plz help me... Link to comment Share on other sites More sharing options...
Nakor Posted March 13, 2007 Share Posted March 13, 2007 You can only send headers and cookies before any other information is sent to the browser. I trust that is not your full code. If you want to redirect with the PHP header() funtion you have to do it before ANYTHING else is sent. This includes whitespace. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now