turtleman8605 Posted June 4, 2007 Share Posted June 4, 2007 Is there a way to redirect a page after the header has already been sent? Link to comment https://forums.phpfreaks.com/topic/54168-redirect-after-with-out-using-header/ Share on other sites More sharing options...
Wildbug Posted June 4, 2007 Share Posted June 4, 2007 Look up "meta tag refresh." Link to comment https://forums.phpfreaks.com/topic/54168-redirect-after-with-out-using-header/#findComment-267817 Share on other sites More sharing options...
turtleman8605 Posted June 4, 2007 Author Share Posted June 4, 2007 meta tags are in the header. I need something that will take a user to another page after processing information on a form. Link to comment https://forums.phpfreaks.com/topic/54168-redirect-after-with-out-using-header/#findComment-267826 Share on other sites More sharing options...
per1os Posted June 4, 2007 Share Posted June 4, 2007 Can you post code? Link to comment https://forums.phpfreaks.com/topic/54168-redirect-after-with-out-using-header/#findComment-267828 Share on other sites More sharing options...
Wildbug Posted June 4, 2007 Share Posted June 4, 2007 From a Googled result: <html> <head> <title>Redirect to the right page</title> <META http-equiv="refresh" content="5;URL=http://www.indiana.edu/~smithclas/l200/"> </head> (source) Unless you are considering <head></head> the header -- and usually by "header" the HTTP header is meant -- then that's not in the header. Link to comment https://forums.phpfreaks.com/topic/54168-redirect-after-with-out-using-header/#findComment-267851 Share on other sites More sharing options...
turtleman8605 Posted June 5, 2007 Author Share Posted June 5, 2007 here's the code: <?php if (array_key_exists('_submit_check', $_POST)) { // The submitted form is valid, so process it process_form(); header( 'location:http://www.morseavenuedesign.com/CinemaSightLines.com/sample_forum.php' ); show_form(); } else { //The form wasn't submitted, so display show_form(); } this doesn't work, I get an error that says "Warning... head has already been sent..." Link to comment https://forums.phpfreaks.com/topic/54168-redirect-after-with-out-using-header/#findComment-268078 Share on other sites More sharing options...
Wildbug Posted June 5, 2007 Share Posted June 5, 2007 (1) Read this sticky post (as you should have already done). (2) See #1. Link to comment https://forums.phpfreaks.com/topic/54168-redirect-after-with-out-using-header/#findComment-268382 Share on other sites More sharing options...
taith Posted June 5, 2007 Share Posted June 5, 2007 or just use my function instead of header()... saves ALOT of troubles! :-) <?php function redirect($filename="?", $delay="0", $die="0"){ if((!headers_sent())&&($delay=="0")) header('Location: '.$filename); elseif($delay=="0"){ echo '<script type="text/javascript">'; echo 'window.location.href="'.$filename.'";'; echo '</script>'; echo '<noscript>'; echo '<meta http-equiv="refresh" content="0;url='.$filename.'" />'; echo '<noscript>'; }else echo '<meta http-equiv="refresh" content="'.$delay.';url='.$filename.'" />'; if($die=="0"){ db_disconnect(); exit; } } ?> Link to comment https://forums.phpfreaks.com/topic/54168-redirect-after-with-out-using-header/#findComment-268386 Share on other sites More sharing options...
per1os Posted June 5, 2007 Share Posted June 5, 2007 here's the code: <?php if (array_key_exists('_submit_check', $_POST)) { // The submitted form is valid, so process it process_form(); header( 'location:http://www.morseavenuedesign.com/CinemaSightLines.com/sample_forum.php' ); show_form(); } else { //The form wasn't submitted, so display show_form(); } this doesn't work, I get an error that says "Warning... head has already been sent..." Does process_form() display any data, if so that is why. Link to comment https://forums.phpfreaks.com/topic/54168-redirect-after-with-out-using-header/#findComment-268444 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.