I have done urlencode
of the variable before passing to the URL
http://example.com/Restaurants?alias=F%26B
But when I try to print like in the page
$alias = rawurldecode($_GET['alias']);
echo $alias;
it prints only F
. How to solve this?
I have done urlencode
of the variable before passing to the URL
http://example.com/Restaurants?alias=F%26B
But when I try to print like in the page
$alias = rawurldecode($_GET['alias']);
echo $alias;
it prints only F
. How to solve this?
I doubt that $_GET['alias']
exists when requesting a URL with the query aliasF%26B
. It’s rather $_GET['aliasF&B']
that’s getting populated.
In this case you need to use $_SERVER['QUERY_STRING']
to get the full query.
It looks like you are not using the query string "correctly." It should be in key=value
pairs. I would look at using $_SERVER['QUERY_STRING']
to get your information instead.