URL lost during POST
What's wierd is that on one page I can echo a variable built by:
$protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https开发者_运维问答') === FALSE ? 'http' : 'https';
$host = $_SERVER['HTTP_HOST'];
$script = $_SERVER['SCRIPT_NAME'];
$params = $_SERVER['QUERY_STRING'];
$currentUrl = $protocol . '://' . $host . $script . '?' . $params;
Then post it to another page (I know the post works because I send other values):
<?php echo'<input type="hidden" name="Refferer" value="'.$currentUrl.'"/>'?>
But when I try to use it on my other page it is now empty:
$return = $_Post[Refferer];
header("Location: $return");
Anyone know what's happening to it?
$_POST is case sensitive.
Try to use $_POST instead of $_Post.
Try:
$return = $_POST['Refferer'];
header("Location: $return");
Try:
<?php echo '<input type="hidden" name="Refferer" value="'.urlencode($currentUrl).'"/>' ?>
精彩评论