Dat Posted July 10, 2008 Share Posted July 10, 2008 I've run through this my head many times and I cannot find a simple solution. I want to have this sort of redirect page that will redirect after a certain amount time, say 3 seconds, and in the direct page I want to display a message based on the previous page's message. For example I have a profile page and users can edit their profile. When they click submit I want them to be directed to a page that tells them to wait 3 seconds and tell them their profile has been updated. Link to comment https://forums.phpfreaks.com/topic/114031-redirecting/ Share on other sites More sharing options...
Third_Degree Posted July 10, 2008 Share Posted July 10, 2008 Ok, use this <html> <head> <meta http-equiv="refresh" content="3;url=update.php"> </head> Profile Updated! Please wait 3 seconds while we redirect you. </html> Link to comment https://forums.phpfreaks.com/topic/114031-redirecting/#findComment-586083 Share on other sites More sharing options...
Guest Xanza Posted July 10, 2008 Share Posted July 10, 2008 You could also use pure PHP do accomplish this: <?php header('Refresh: 3; url=update.php'); echo "Profile Updated! Please wait 3 seconds while we redirect you."; ?> Link to comment https://forums.phpfreaks.com/topic/114031-redirecting/#findComment-586102 Share on other sites More sharing options...
Third_Degree Posted July 10, 2008 Share Posted July 10, 2008 You could also use pure PHP do accomplish this: <?php header('Refresh: 3; url=update.php'); echo "Profile Updated! Please wait 3 seconds while we redirect you."; ?> Very true Link to comment https://forums.phpfreaks.com/topic/114031-redirecting/#findComment-586105 Share on other sites More sharing options...
Dat Posted July 10, 2008 Author Share Posted July 10, 2008 Maybe this will help what i'm faced up against: ...Snip of code... if(something) { $success[] = You've done something correct; ... Now I need to redirect to the redirect page to display this message ... } Link to comment https://forums.phpfreaks.com/topic/114031-redirecting/#findComment-586117 Share on other sites More sharing options...
Third_Degree Posted July 10, 2008 Share Posted July 10, 2008 Hope this helps: Edit Page <?php if ( something ) { $success[] = "You've done something right"; header( "Location: redirect.php?message=" . $success[0] ); } ?> Redirect Page <?php header( "Refresh: 3; url=profile.php" ); print htmlentities( $_GET["message"], ENT_QUOTES );//htmlentities() for security ?> Link to comment https://forums.phpfreaks.com/topic/114031-redirecting/#findComment-586135 Share on other sites More sharing options...
wrathican Posted July 10, 2008 Share Posted July 10, 2008 just a reminder! all headers in php need to be sent BEFORE ANY CONTENT. so you can have a massive if statement as deep as you want but if there is any 'echo' or html before the header() function. you get an error. Link to comment https://forums.phpfreaks.com/topic/114031-redirecting/#findComment-586183 Share on other sites More sharing options...
Guest Xanza Posted July 10, 2008 Share Posted July 10, 2008 wrath is right - take another look at this.. <?php if($something) { $success[] = "You've done something right"; header("Location: redirect.php?message=" . $success[0]); } ?> Link to comment https://forums.phpfreaks.com/topic/114031-redirecting/#findComment-586276 Share on other sites More sharing options...
Third_Degree Posted July 10, 2008 Share Posted July 10, 2008 wrath is right - take another look at this.. <?php if($something) { $success[] = "You've done something right"; header("Location: redirect.php?message=" . $success[0]); } ?> ... nothing is wrong Link to comment https://forums.phpfreaks.com/topic/114031-redirecting/#findComment-586806 Share on other sites More sharing options...
Third_Degree Posted July 10, 2008 Share Posted July 10, 2008 in any case, ob_start( ) works wonders... Link to comment https://forums.phpfreaks.com/topic/114031-redirecting/#findComment-586812 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.