Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open another page in php [duplicate]

Tags:

redirect

php

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?

like image 598
prometheuspk Avatar asked Oct 23 '11 11:10

prometheuspk


People also ask

How to link one page with another page in PHP?

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.

Is there a PHP function that opens a page in another browser?

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.

How to redirect to another page in a PHP file?

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.

How do I open a new page using PHP?

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.


2 Answers

<?php
    header("Location: index.html");
?>

Just make sure nothing is actually written to the page prior to this code, or it won't work.

like image 66
Sven Avatar answered Nov 30 '22 05:11

Sven


Use the following code:

if(processing == success) {
  header("Location:filename");
  exit();
}

And you are good to go.

like image 32
NoPHPknowldege Avatar answered Nov 30 '22 04:11

NoPHPknowldege