Jump to content

Page Redirect


james_byrne

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.