Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Forwarding in PHP |
|
Author |
|
sb.net
Joined: 22 Sep 2006 Posts: 120 Location: USA
|
Posted: Thu 16 Nov '06 16:39 Post subject: Forwarding in PHP |
|
|
I have a script, and I need it so that on if no GET method is selected that it forwards to the home page. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Thu 16 Nov '06 17:29 Post subject: |
|
|
Code: |
if($_GET['something']==""){
/* Redirect to a different page in the current directory that was requested */
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$extra = 'mypage.php';
header("Location: http://$host$uri/$extra");
exit;
}
else
{
//do some other stuff
}
|
http://ww.php.net/header |
|
Back to top |
|
sb.net
Joined: 22 Sep 2006 Posts: 120 Location: USA
|
Posted: Thu 16 Nov '06 18:39 Post subject: |
|
|
Thanks, it works great. |
|
Back to top |
|
|
|
|
|
|