Jump to content

how to forward a page using PHP


hasanatkazmi

Recommended Posts

Agreed with thorpe...

 

However if you wanted like a little 'splash' page that says something like, you will be redirected in five seconds... I would recommend using JavaScript.

 

However, if they have JavaScript disabled or a JavaScript non-supported browser... they wont be redirected.

 

this is why you usually provide a link stating "if you have not been re-directed in 5 seconds, please click here".

 

It is usually easier to use a client side script to re-direct with a 5 second splash page opposed to having a server side redirect you.

 

If you want this to be instantaneous... use the method above.

header("Location: http://site.com/otherpage.php");

 

For a JavaScript redirect tutorial, check here: http://www.tizag.com/javascriptT/javascriptredirect.php

Not quite sure how logical this may be, but if you want to go to another page maybe you could just just use include?

 

Like..

 

if (..) {
include('page.php');
} 

 

But if it turns out that you have something that is already written out that you don't want there, you could always try to just set the text that is displayed before the redirect, and destroy it as you redirect. Something like:

 

$text = 'Hello World';
echo $text;

if (..) {
unset($text);
include('page.php');
}

 

Those are my thoughts..

 

This would only work if it is inside of a function.

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.