Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: $_GET Not Working on index.php
07-04-2013, 12:44 PM #1
- Join Date
- Jan 2009
- Glasgow, UK
- Thanked 13 Times in 13 Posts
$_GET Not Working on index.php
Bit of a silly problem on the website I work on, hoping to find a solution.
I've created a cookie consent banner (to comply with EU law). When the user clicks accept, it reloads the current page but with a ?accept-cookies after the URL. The code then checks for this and sets a cookie which means the banner doesn't show any more.
This works on EVERY SINGLE PAGE except the index. I'm assuming it's because the index strips the actual "/index.php" part from the URL and leaves it just as www.example.com?accept-cookies so for some reason the code doesn't check for the $_GET variable in this instance. Just to reiterate, on any other page (for example www.example.com/anotherpage.php?accept-cookies) this works perfectly.
Does anyone have any idea how I can get round this?
07-04-2013, 01:59 PM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,659 Times in 2,628 Posts
That shouldn't matter. site.com/index.php?get=value is equivalent to site.com/?get=value. The querystring is still present so as long as you are checking in the $_GET you should find what you are looking for.
Are you using mod_rewrite to rewrite the url's? Another thing to look for is redirections or any type of redirect which can strip the querystrings.
header('HTTP/1.1 420 Enhance Your Calm');