tobywuk Posted June 16, 2006 Share Posted June 16, 2006 i have the code[code]if($_POST[password] == $correct){http "blogentry.php";} else {echo "Password was incorect";include("index.php");}?>[/code]im trying to make it so if the password is entered correctly the page blogentry.php will load. the only thing is i dont know how to do this. I know if i put echo"password is correct" this will display but i dont want just text to display i want the page to actualy load. I'v tried include"blogentry.php" but this just opens up that page within that webpage which i dont wantcan anyone help? Quote Link to comment https://forums.phpfreaks.com/topic/12157-if-statment-to-open-diffrent-page/ Share on other sites More sharing options...
kenrbnsn Posted June 16, 2006 Share Posted June 16, 2006 You want to use the [a href=\"http://www.php.net/header\" target=\"_blank\"]header[/a]() function here:[code]<?phpif($_POST['password'] == $correct){ header("location: blogentry.php"); exit();} else {echo "Password was incorect";include("index.php");}?>[/code]Ken Quote Link to comment https://forums.phpfreaks.com/topic/12157-if-statment-to-open-diffrent-page/#findComment-46287 Share on other sites More sharing options...
tobywuk Posted June 16, 2006 Author Share Posted June 16, 2006 i put that in but now i getWarning: Cannot modify header information - headers already sent by (output started at /home/tobywuk/public_html/nstorm/bloglogin.php:9) in /home/tobywuk/public_html/nstorm/bloglogin.php on line 21line 21 is [code]header("location: blogentry.php");[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12157-if-statment-to-open-diffrent-page/#findComment-46292 Share on other sites More sharing options...
kenrbnsn Posted June 16, 2006 Share Posted June 16, 2006 Read the [a href=\"http://www.phpfreaks.com/forums/index.php?s=&showtopic=37442&view=findpost&p=138336\" target=\"_blank\"]sticky note[/a] at the top of the forum.Ken Quote Link to comment https://forums.phpfreaks.com/topic/12157-if-statment-to-open-diffrent-page/#findComment-46296 Share on other sites More sharing options...
wildteen88 Posted June 16, 2006 Share Posted June 16, 2006 Dont forget to read the [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=95562\" target=\"_blank\"]FAQ/Code Respority[/a] forum either. Quote Link to comment https://forums.phpfreaks.com/topic/12157-if-statment-to-open-diffrent-page/#findComment-46316 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.