0

I'm trying to fetch data from URL to show product seller name in the frontend, I used one seller name like abc&xyz, but when I'm trying to display data on fancy box data is not visible. Here is my URL looks like this, seller_info.php?seller_name=abc&xyz.

here you can see data is not visible of this abc&xyz variable:

So my question is how to use & between name and display data using URL. I hope I tried to explain to you my query.

pete the pagan-gerbil
  • 3,136
  • 2
  • 28
  • 49
Rahul
  • 11
  • 3
  • Hi and welcome! It would be easier for people to help you if you post your PHP code. Also the character & has a specific usage in get requests. See https://www.w3schools.com/tags/ref_httpmethods.asp It can cause the understanding of parameters in the get request to be understood differently. Does a request like seller_info.php?seller_name=RandomName appear OK? – Spyros K Jul 15 '20 at 13:49

1 Answers1

0

& is used as a field separator in your url query.
You can use %26 which is your & encoded to be used in an uri.

You can read more about it on MDN

Askirkela
  • 1,120
  • 10
  • 20
  • I used & in 'product seller' name like 'abc&xyz'. Actually the process is I used query to display product seller name in the frontend from the backend, and on click of that name fancy box will popup to display whole data of that seller from other pages with the help of URL, but the issue is query not able to fetch seller name from URL due to & ex 'SELECT * FROM seller WHERE `seller_name` = 'abc'', so how should I fetch name from URL with & – Rahul Jul 15 '20 at 13:59
  • so the issue is request goes by ajax and & is the key to separate variables – Rahul Jul 15 '20 at 14:06
  • Yes. You need to escape the character. If you are working with Ajax, you can use `encodeURIcomponent("abc&xyz")` which will give you `"abc%26xyz"` – Askirkela Jul 15 '20 at 14:09