anybody99 Posted March 15, 2007 Share Posted March 15, 2007 hey, if the IF statement is false, i want to direct to other page, is there any way i can do that, or what the name of it? -Rob Quote Link to comment https://forums.phpfreaks.com/topic/42914-direct-to-other-page-if-the-if-is-false/ Share on other sites More sharing options...
aebstract Posted March 15, 2007 Share Posted March 15, 2007 header("Location: something.php"); put that in your if false Quote Link to comment https://forums.phpfreaks.com/topic/42914-direct-to-other-page-if-the-if-is-false/#findComment-208424 Share on other sites More sharing options...
predator Posted March 15, 2007 Share Posted March 15, 2007 hey, you can do it with javascript simply add echo "<script type='text/javascript'> location.href='page goes here</script>"; to the if Quote Link to comment https://forums.phpfreaks.com/topic/42914-direct-to-other-page-if-the-if-is-false/#findComment-208425 Share on other sites More sharing options...
aebstract Posted March 15, 2007 Share Posted March 15, 2007 Though this happens to be the php help forums? Quote Link to comment https://forums.phpfreaks.com/topic/42914-direct-to-other-page-if-the-if-is-false/#findComment-208428 Share on other sites More sharing options...
predator Posted March 15, 2007 Share Posted March 15, 2007 i am just giving him options no need to get too deffensive Quote Link to comment https://forums.phpfreaks.com/topic/42914-direct-to-other-page-if-the-if-is-false/#findComment-208430 Share on other sites More sharing options...
pea_1 Posted March 15, 2007 Share Posted March 15, 2007 I use that javascript method, headers won't work if you have the head tag in a website. Quote Link to comment https://forums.phpfreaks.com/topic/42914-direct-to-other-page-if-the-if-is-false/#findComment-208432 Share on other sites More sharing options...
aebstract Posted March 15, 2007 Share Posted March 15, 2007 I wasn't being defensive, if anything.. offensive. I am just stating that he is asking for php help. Theres a solution for his problem with php, no need to even mention javascript then? Sorry.. BTW: Headers will work, put header("Cache-control: private"); at the top of your page and you don't have anythin to worry about. Quote Link to comment https://forums.phpfreaks.com/topic/42914-direct-to-other-page-if-the-if-is-false/#findComment-208434 Share on other sites More sharing options...
anybody99 Posted March 15, 2007 Author Share Posted March 15, 2007 hey, it's good. i want to do, if bla bla is false than put this ip into banned ..etc. AND redirect to another page but IF it's true that "ELSE" would be just something written...can i do that? can i add another command to do if the answer is false? Quote Link to comment https://forums.phpfreaks.com/topic/42914-direct-to-other-page-if-the-if-is-false/#findComment-208463 Share on other sites More sharing options...
aebstract Posted March 15, 2007 Share Posted March 15, 2007 if ($blabla == FALSE) { put this ip into banned header("Location: something.php"); } else { echo "hi"; } That what you are looking for? Quote Link to comment https://forums.phpfreaks.com/topic/42914-direct-to-other-page-if-the-if-is-false/#findComment-208464 Share on other sites More sharing options...
per1os Posted March 15, 2007 Share Posted March 15, 2007 if (!$blabla) { put this ip into banned header("Location: something.php"); } else { echo "hi"; } No sense it setting it == to false it can cause more confusion that way =) Quote Link to comment https://forums.phpfreaks.com/topic/42914-direct-to-other-page-if-the-if-is-false/#findComment-208478 Share on other sites More sharing options...
anybody99 Posted March 16, 2007 Author Share Posted March 16, 2007 hey, this is great, the code works fine. however i am wondering now, if to put this code into an html page or in a seperate php page, and is index.php will be loaded automaticley when i load my domain name? thanks Quote Link to comment https://forums.phpfreaks.com/topic/42914-direct-to-other-page-if-the-if-is-false/#findComment-208502 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.