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: Header location with get method |
|
Author |
|
sb.net
Joined: 22 Sep 2006 Posts: 120 Location: USA
|
Posted: Thu 30 Nov '06 0:17 Post subject: Header location with get method |
|
|
I have this: Code: | <?php
$redir = $_GET["redir"];
header("Location: $redir");
?> |
All that I get is it forwards it to $redir. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Thu 30 Nov '06 10:32 Post subject: |
|
|
your script works fine if $_GET is not empty
http://127.0.0.1/test.php?redir=bla.htm
But id $_GET is empty there is no location where header an redirect to.
Code: |
<?php
if($_GET['redir']!=""){
$redir = $_GET['redir'];
}
else
{
$redir='index.htm';
}
header("Location: $redir");
die();
?>
|
|
|
Back to top |
|
sb.net
Joined: 22 Sep 2006 Posts: 120 Location: USA
|
Posted: Sat 02 Dec '06 17:03 Post subject: |
|
|
Thanks the script works great. |
|
Back to top |
|
|
|
|
|
|