Hi, I want to show '&' instead '&' in the internet address line as part of the code. http://sample.php?customer=xxx&phone=yyy but I got http://sample.php?customer=xxx&phone=yyy In the php code it is &. How did it get converted to &? How to get it back to &? Thanks in advanced.
Yes. I am using PHP. I had tried urlencode($str) and filter_var($str, FILTER_SANITIZE-ENCODED). But it doesn't do what I want.
Did you by any chance use the htmlentities() or htmlspecialchars() function on the url. Those two will change "&" to "&" Can you show me a sample of your code, I can help you better that way.
I noticed a problem. For the following code, the 1st header change the & to & which is not what I want. But the 2nd header example does what I want and keep the & in the url when I ran it. Do you know why? Thanks for any help in advanced. $url = 'http://www.abc.com/sample.php?customer=Jane&phone=1234567'; header('Location: ' . $url); header('Location: http://www.abc.com/sample.php?customer=Jane&phone=1234567');
I think htmlspecialchars() is the reason for my problem. I found it in the link function. Because this is a huge program and I am trying to simplify my problem here so I don't ask any experts to dig through the huge codes while trying to help me. Sorry for not having all the information here. Thanks for your help and the tip of htmlspecialchars() here.