logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in  RSS Apache Lounge  


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

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.


Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: Forwarding in PHP
Author
sb.net



Joined: 22 Sep 2006
Posts: 120
Location: USA

PostPosted: Thu 16 Nov '06 16:39    Post subject: Forwarding in PHP Reply with quote

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: 7031
Location: Germany, Next to Hamburg

PostPosted: Thu 16 Nov '06 17:29    Post subject: Reply with quote

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

PostPosted: Thu 16 Nov '06 18:39    Post subject: Reply with quote

Thanks, it works great. Smile
Back to top


Reply to topic   Topic: Forwarding in PHP View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner