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 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 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(); ?> 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 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. 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- 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 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(); 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 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
Archived
This topic is now archived and is closed to further replies.