I'm trying to encode a url like this,
$code = '2'; header('Location: http://www.whatever.com/page.php?='.urlencode($code).''); exit();
and then decoding it on the page.php page like this,
$url = $_SERVER['REQUEST_URI']; $decodedurl = urldecode($url); $code = $_GET[$decodedurl]; echo $code;
But when the header redirects to page.php, "2" doesn't get encoded, it just says "page.php?code=2"
How can I get this to work? Thanks for your time.