james_byrne Posted July 12, 2008 Share Posted July 12, 2008 I am trying to make a cms for a website, and i am not really that knowledgeable in php, i have done more codding in asp. but i need to know how to after you have had php complete a task to redirect to a page. I have found a way with the header function but that will not work for me because there is already content on the page. I know in asp you do response.redirect(url) is there something simmlar in php?? Thanks in advance for the help. Link to comment https://forums.phpfreaks.com/topic/114458-page-redirect/ Share on other sites More sharing options...
LooieENG Posted July 12, 2008 Share Posted July 12, 2008 <?php echo '<meta http-equiv="refresh" content="0;url=http://www.domain.com">'; ?> Link to comment https://forums.phpfreaks.com/topic/114458-page-redirect/#findComment-588542 Share on other sites More sharing options...
teynon Posted July 12, 2008 Share Posted July 12, 2008 You can either output an HTML redirect like LooieENG posted, a javascript redirect like <script>document.location.href='newpage.php';</script> or you can set up an output buffer on your PHP and use the header('Location: blah'); To use the buffer option: <?php ob_start(); // My PHP SCRIPT ob_end_flush(); ?> This prevents output so headers wont be sent until the entire page is finished. ob_start can also call a function so you can modify output if you want. http://us2.php.net/manual/en/function.ob-start.php Link to comment https://forums.phpfreaks.com/topic/114458-page-redirect/#findComment-588543 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.