unemployment Posted March 31, 2011 Share Posted March 31, 2011 I want the page to refresh on with the query string, but this isn't working for me... header("Location: " . $_SERVER['php_self'] . "?" . $_SERVER['query_string'] ); Quote Link to comment Share on other sites More sharing options...
btherl Posted March 31, 2011 Share Posted March 31, 2011 The $_SERVER array is case sensitive, and you need to use uppercase. Quote Link to comment Share on other sites More sharing options...
unemployment Posted March 31, 2011 Author Share Posted March 31, 2011 The $_SERVER array is case sensitive, and you need to use uppercase. so in other words, do this? header("Location: " . $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'] ); Quote Link to comment Share on other sites More sharing options...
unemployment Posted March 31, 2011 Author Share Posted March 31, 2011 The $_SERVER array is case sensitive, and you need to use uppercase. so in other words, do this? header("Location: " . $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'] ); That didn't seem to work for me. Quote Link to comment Share on other sites More sharing options...
btherl Posted March 31, 2011 Share Posted March 31, 2011 What are the contents of $_SERVER['PHP_SELF'] and $_SERVER['QUERY_STRING'] ? Quote Link to comment Share on other sites More sharing options...
unemployment Posted March 31, 2011 Author Share Posted March 31, 2011 What are the contents of $_SERVER['PHP_SELF'] and $_SERVER['QUERY_STRING'] ? PHP SELF is blog.php QUERY STRING is ?post_id=18 Together they make blog.php?post_id=18 and yes the above does not work for me. It just redirects me to blog.php Quote Link to comment Share on other sites More sharing options...
btherl Posted March 31, 2011 Share Posted March 31, 2011 That's strange.. you can try this: $redirect = $_SERVER['PHP_SELF'] . $_SERVER['QUERY_STRING']; print "Would redirect to $redirect if we weren't exiting now"; exit; header("Location: $redirect"); Once you've confirmed that $redirect is correct you can remove the "exit;". If $redirect really is the right url then I don't see why it wouldn't work Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.