PHP MYSQL Save search query into database
I have search on my site where user can sear开发者_如何学Pythonch in titles, description and select categories.
I wont to save the search into database but only if user wonts to save it.
This is my link which save into database. domain.com/save/?action=save&reference=SEARCH_QUERY.
but because i have title&description&cat.
It stop at & save the first part of the query.
How can i save this in to database including the & as i need to get this back so user can go back to save search query later on.
I have used htmlentities and htmlspecial but still it turns into & but first char is &.
Sounds like you need urlencode
:
echo urlencode('title=t&description=d&cat=c');
results in
title%3Dt%26description%3Dd%26cat%3Dc
You need to use urlencode to encode parameter that are passed in the URL.
htmlentities and htmlspecialchars are function that are used to espace string that will end up in HTML code, not in URL.
Maybe you're looking for urlencode
?
精彩评论