phpisawesome Posted August 21, 2008 Share Posted August 21, 2008 Ok so basically at the end of my script...I want it to redirect to another page, but still print to the screen the text I want it to...can anyone help? So on the page it redirects to display the text as it would if I didn't redirect the page... Quote Link to comment https://forums.phpfreaks.com/topic/120642-redirect-help/ Share on other sites More sharing options...
trq Posted August 21, 2008 Share Posted August 21, 2008 Sorry, you want to display text then redirect? Theres no point, it wont be seen. You want to redirect to a page displaying text? Whats the problem? Quote Link to comment https://forums.phpfreaks.com/topic/120642-redirect-help/#findComment-621631 Share on other sites More sharing options...
phpisawesome Posted August 21, 2008 Author Share Posted August 21, 2008 on the new page display the text Quote Link to comment https://forums.phpfreaks.com/topic/120642-redirect-help/#findComment-621635 Share on other sites More sharing options...
trq Posted August 21, 2008 Share Posted August 21, 2008 All you need do is create a page with the text you want then redirect to it. I don't understand the issue. Quote Link to comment https://forums.phpfreaks.com/topic/120642-redirect-help/#findComment-621639 Share on other sites More sharing options...
phpisawesome Posted August 21, 2008 Author Share Posted August 21, 2008 when you click the link it does the action...on a certain php file...now on that php file I want it to do what it's supposed to...and redirect to another page displaying the text from earlier in the script. Please help. Quote Link to comment https://forums.phpfreaks.com/topic/120642-redirect-help/#findComment-621643 Share on other sites More sharing options...
Lamez Posted August 21, 2008 Share Posted August 21, 2008 <?php session_start(); $_SESSION['message'] = "Text from script"; //sets message to a session variable. header("Location: new_page.php"); //redirects to new_page.php in 0s echo $_SESSION['message']; //echos out Text from script ?> Quote Link to comment https://forums.phpfreaks.com/topic/120642-redirect-help/#findComment-621644 Share on other sites More sharing options...
unkwntech Posted August 21, 2008 Share Posted August 21, 2008 echo "BLAH BLAH BLAH"; echo '<meta http-equiv="refresh" content="5;url=page.htm"/>' --^ will delay it 5 seconds. Quote Link to comment https://forums.phpfreaks.com/topic/120642-redirect-help/#findComment-621647 Share on other sites More sharing options...
phpisawesome Posted August 21, 2008 Author Share Posted August 21, 2008 is this the only way? Quote Link to comment https://forums.phpfreaks.com/topic/120642-redirect-help/#findComment-622228 Share on other sites More sharing options...
BlueSkyIS Posted August 21, 2008 Share Posted August 21, 2008 one way, correcting previous post <?php session_start(); if ($_GET['show'] == 1) { echo $_SESSION['message']; //echos out Text from script } else { $_SESSION['message'] = "Text from script"; //sets message to a session variable. header("Location: new_page.php?show=1"); //redirects to new_page.php in 0s exit; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/120642-redirect-help/#findComment-622249 Share on other sites More sharing options...
phpisawesome Posted August 21, 2008 Author Share Posted August 21, 2008 So when I click the link I want it to perform the action on the php action page and on the page it redirects to display what it needs to display So here's an example Click here to add me as a friend! So when you click here it does the action in the php file...and it redirects you to the main friends page but displaying the results from the action page... Quote Link to comment https://forums.phpfreaks.com/topic/120642-redirect-help/#findComment-622261 Share on other sites More sharing options...
phpisawesome Posted August 21, 2008 Author Share Posted August 21, 2008 thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/120642-redirect-help/#findComment-622408 Share on other sites More sharing options...
BlueSkyIS Posted August 21, 2008 Share Posted August 21, 2008 store the value that needs to appear on the second page, then retrieve it and display it on the second page. i would use a SESSION variable to store the value on the first page, then when the visitor arrives on the second page, i would echo the value of that SESSION variable. just like my example, but splitting it onto 2 pages instead of just 1 like I did. Quote Link to comment https://forums.phpfreaks.com/topic/120642-redirect-help/#findComment-622414 Share on other sites More sharing options...
revraz Posted August 21, 2008 Share Posted August 21, 2008 So what is wrong with unkwntech's example, it's exactly what you describe. Quote Link to comment https://forums.phpfreaks.com/topic/120642-redirect-help/#findComment-622454 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.