kate_rose Posted June 23, 2008 Share Posted June 23, 2008 I know this is a dumb question but how do do this if ($blah <> false { send user to new page } Its the sending the user to the new page part I don't know. Thanks, Kate Quote Link to comment https://forums.phpfreaks.com/topic/111544-solved-newb-question-send-user-to-new-page/ Share on other sites More sharing options...
.josh Posted June 23, 2008 Share Posted June 23, 2008 header("Location: http://www.blah.com/somepage.php"); note: can't have any output before sending stuff to header Quote Link to comment https://forums.phpfreaks.com/topic/111544-solved-newb-question-send-user-to-new-page/#findComment-572493 Share on other sites More sharing options...
Jabop Posted June 23, 2008 Share Posted June 23, 2008 <?php header("Location: /newpage.html"); die(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/111544-solved-newb-question-send-user-to-new-page/#findComment-572494 Share on other sites More sharing options...
kate_rose Posted June 23, 2008 Author Share Posted June 23, 2008 I read about that method & it is used to redirect users when a page has been moved right?? This will be in the middle of my php code so users will only be redirected if certain conditions are met. What exactly do you mean by no output? I assign session variables & work with arrays etc. What counts as output & what doesn't? Do you mean only stuff the user will see? k Quote Link to comment https://forums.phpfreaks.com/topic/111544-solved-newb-question-send-user-to-new-page/#findComment-572499 Share on other sites More sharing options...
.josh Posted June 23, 2008 Share Posted June 23, 2008 yes, "stuff the user will see." you can do any kind of code you want but you can't echo/print anything or have whitespaces before code tags or regular text/html/whatever etc.. before it. Quote Link to comment https://forums.phpfreaks.com/topic/111544-solved-newb-question-send-user-to-new-page/#findComment-572500 Share on other sites More sharing options...
kate_rose Posted June 23, 2008 Author Share Posted June 23, 2008 Thanks C. Violent, I will give it a try. K- Quote Link to comment https://forums.phpfreaks.com/topic/111544-solved-newb-question-send-user-to-new-page/#findComment-572509 Share on other sites More sharing options...
The Little Guy Posted June 23, 2008 Share Posted June 23, 2008 // PHP code ONLY NO ECHO's OR PRINT's even in include files. if (!$blah) { header("Location: somepage.php"); exit; } // HTML and/or PHP code Quote Link to comment https://forums.phpfreaks.com/topic/111544-solved-newb-question-send-user-to-new-page/#findComment-572511 Share on other sites More sharing options...
Jabop Posted June 23, 2008 Share Posted June 23, 2008 Don't forget die(); Quote Link to comment https://forums.phpfreaks.com/topic/111544-solved-newb-question-send-user-to-new-page/#findComment-572513 Share on other sites More sharing options...
The Little Guy Posted June 23, 2008 Share Posted June 23, 2008 Don't forget die(); exit works too Quote Link to comment https://forums.phpfreaks.com/topic/111544-solved-newb-question-send-user-to-new-page/#findComment-572515 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.