Possible Duplicate:
PHP page redirect
how do i redirect to another page in php, once a process is finished.
for example my <form>
tag sets the action attribute to "process.php". After the process on process.php is finished i want it to redirect to the site it cam from. how is that done?
First of all, PHP is a Server Side Scripting Language. So we can’t run Button Clicks Events using PHP but we can use HTML Anchor, Form or JavaScript inside PHP to Link One page with Another Page. In HTML’s Form tag we can Link submit Button to another page using HTML Form’s Action Attribute.
There is’nt any PHP function that opens a page in a new browser tab. However, there is a function called header () that would redirect to a different URL in a special case using the "Location:" header. It sends this header back to the browser, but it also returns a REDIRECT (302) status code to the browser unless already set.
You can conditionally redirect to some page within a php file.... Assuming you're using cookies for login, just call it after your setcookie call -- after all, you must be calling that one before any output too.
You cannot open a new window / new tab using PHP. You must use Javascript to do that. And in the year 2008, it will most-likely be blocked by pop-up blocker. You will have to use a URL and have the person click on it. <a href="new_page.php" target="_new">Continue to next page</a>. WorldNews September 1, 2014, 8:03pm #5.
<?php
header("Location: index.html");
?>
Just make sure nothing is actually written to the page prior to this code, or it won't work.
Use the following code:
if(processing == success) {
header("Location:filename");
exit();
}
And you are good to go.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With