0

I have a problem on my webpage with an querystring I have to pass inside a querystring.

The main querystring is a cookie checker. And inside this I need to pass a second URL that contain also a querystring with &. The second querystring is now broken after website is parsed:

http://www.myurl.com/check_affiliate_cookie_exist.jsp?contractId=3241248&referrer=*&foundString=linkok&notFoundString=https%3A%2F%2Fwww.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WZ7CHZVKKLNQW"

When I now click on the second link, it is broken at & and the second part of this "sub querystring" is broken.

Any idea how to deal with this?

1
  • Use PHP's urlencode() to encode characters like & to be passed in the url. Then call urldecode() to retrieve the original url. Commented Oct 27, 2015 at 11:31

2 Answers 2

1

You need to escape, you can use js for example

var url = mainUrl + encodeURIComponent(secondUrl);
Sign up to request clarification or add additional context in comments.

Comments

0

You should use rawurlencode if you're using PHP. You will then need to decode the URL using rawurldecode. If you're not using PHP, then check for equivalent functions in your scripting language.

Hope this helps!

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.