Hi :)

I am trying to build a simple mechanism to allow visitors to set a site preference (stored in a cookie) by clicking on a link. I want the cookie set and the original page reloaded with the new cookie set, when a visitor clicks on the link.

My link looks like this...

<a href="/switch.php?userLangChoice=fr&amp;sender=<?php echo $_SERVER['REQUEST_URI']; ?>">French</a>

My file switch.php looks like this...

<?php

        setcookie("userLang", $userLangChoice);

    if ($sender == "")
        $sender = "index.php";
    else
        $sender = "$sender";
                
     header("location:".$sender);

?>

Now, for the most part this works fine, but in some cases, my referring URL ($sender) is being truncated. Simple URLs such as '/listingsearch.php?Category%5B%5D=Hunting' work fine, although it is being returned as '/listingsearch.php?Category[]=Hunting'. More complex URLs like '/listingsearch.php? Accommodation%5B%5D=Outpost&Category%5B%5D=Fishing&Region%5B%5D=North- West' are being truncated at the first variable down to '/listingsearch.php?Accommodation[]=Outpost'

Is there something I can do to make sure the referring URL is not truncated and it would also be nice if it was left alone and not encoded or decoded.

Any thoughts? Thanks,
verdon

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to