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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.