Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder Common's Avatar
    Join Date
    Jan 2009
    Location
    Glasgow, UK
    Posts
    132
    Thanks
    16
    Thanked 13 Times in 13 Posts

    $_GET Not Working on index.php

    Hi there

    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?

    Many thanks!

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •