Forum Moderators: coopster
we often need to send query strings as the value of another parameter. e.g.
/redirect.php?refpage=/mypage.php?mode=view&ID=45678
where we need to capture the full value of refpage and redirect the user to that value (in the case above /mypage.php?mode=view&ID=45678)
however because there is an extra ampersand in it, the value is not stored correctly. one way round it is to use base64_encode() to encode the value of refpage. however this results in a very long string - too long for some email clients, which break it and make it non-clickable.
does anyone know any alternatives for encoding query strings which, say, result in a 32 length string or even shorter?
many thanks!
<?php
$string = 'refpage=/mypage.php?mode=view&ID=45678';
print "$string\n";
print urlencode($string)."\n";
?>
<a href="/redirect.php?<?php print urlencode($string);?>">Click here</a>