I have this:
browse_cat.php?cat_gr='Mopeds & Traktors'">
The browse_cat.php contains this to fetch the above "category":
$cat=$_GET['cat_gr'];
echo $cat;
This ec开发者_C百科ho outputs the first word only "Mopeds". It wont change if I replace the & with &.
What is the problem here?
The adress bar when I enter browse_cat.php shows:
browse_cat.php?cat_gr='Mopeds%20&%20Traktors'
Thanks
Take a look at urlencode()
and urldecode()
.
Also, remove the single quotes around your query string.
Your url query values should not have quotes around them. You also need to urlencode the & and the spaces. Here is the correct url:
browse_cat.php?cat_gr=Mopeds%20%26%20Traktors
%20 is the html entity for a space. URL shouldn't contain any.
精彩评论