0

I have search on my site where user can search 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 &.

2
  • try urlencode and then urldecode when you got to use the saved query. Commented Dec 21, 2010 at 22:32
  • Sorry i dont know what that was but i do that now. Thank Commented Dec 22, 2010 at 9:22

3 Answers 3

1

Sounds like you need urlencode:

echo urlencode('title=t&description=d&cat=c');

results in

title%3Dt%26description%3Dd%26cat%3Dc
Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

0

Maybe you're looking for urlencode?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.