I'm passing simple query string:
index.php?a=orange&apple
Getting value with:
$_GET['a'];
it only shows orange
value. i have tried
$a = urlencode($_GET['a']);
$rs = urldecode($a);
echo $rs; // orange;
but didn't work. Found similar question here stackoverflow but seems not useful. How do i get complete value orange&apple
?
That is because &
makes apple
as another value in GET
request.
Like this -
/test/demo_form.php?name1=value1&name2=value2
So use '%26'
(encoding URI Component) in place of &
like this -
index.php?a=orange%26apple
And get the value with $_GET['a'];
. This should work.