Jump to content

need help in rdirecting to another page


piyus168

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...