Reputation: 65
got high hopes seeing how well my first question was answered so I will try to word this as best I can but if you need anymore info just shout.
I have a site that I have built that works fine on all the different test servers we use, but is now on a client's server and a small bug has arisen that after searching around I understand why it is doing it, but not sure of the best way to fix it.
Basically on one of the page I have a php if statement to determine if the querystring is present, this code is below
<?php if (isset($_GET['area'])) { ?>
<script type="text/javascript">
$(function() {
setTimeout(function() {
$('#<?php echo $_GET['area']; ?>-popup').click();
}, 500);
});
</script>
<?php } ?>
All works great on my servers, however on the client's this isset($_GET['area'])
always return true
. What it is doing is that when you go onto the page using the link that adds the ?area=test
, the server is storing this value, and whenever I go back onto this page it thinks that the GET
is true and then performs the popup, even though there is no querystring.
Very annoying, I was thinking of clearing the session perhaps but it seems overkill, is there an unset $_GET
function that I could perform prior to checking if the query string exists.
Hopefully that made sense I've never had to do something like this before, it seems mad that a server would store $_GET
S.
Thanks in advance.
Upvotes: 1
Views: 1510
Reputation: 24815
$_GET
does not get cached.
However, I can imagine you do a check somewhere with a single =
.
Something like;
if ($_GET['area'] = 'test')
This will set it, and make it true. Thus you will always have it (and this if()
will also be true in that case
Upvotes: 2
Reputation: 7597
This is impossible. There's no $_GET['parameter'] if 'parameter' is not in the url. If the isset() returns true, it is present in the url.
Either the browser caches the url WITH get parameter or you 'spoof' the parameter somewhere else.
Upvotes: 2
Reputation: 10314
There is no cache for $_GET
as long as I know.
Moreover, usually you'll set a random GET
value to avoid server cache like ?seed=123131153131
Are you sure about the request you send to Php when displaying the page ?
Upvotes: 2