0

yeah, I know, the title is kind of confusing, but no better title came to my mind. Here is my problem:

I want to use a link in my application, which would look like this: localhost/index?jumpto=some_folder/somescript.php?someparam1=1234&someparam2=4321

The problem is that &someparam2 is meant to hang on the second $_GET-Param. It would be like this: localhost/index?jumpto=some_folder/somescript.php?someparam1=1234&someparam2=4321

Instead, PHP interprets that &someparam2 hangs on the first $_GET-Param. localhost/index?jumpto=some_folder/somescript.php?someparam1=1234&someparam2=4321

Does anyone know a solution for this?
I already tried
localhost/index?jumpto='some_folder/somescript.php?someparam1=1234&someparam2=4321'
but of course that didn't work.

I hope you can understand my problem. Thank you for your time.

1

1 Answer 1

1

You will need to URL encode your string some_folder/somescript.php?someparam1=1234 so that php will not parse & in the query string as a param separator.

use urlencode("some_folder/somescript.php?someparam1=1234");

Sign up to request clarification or add additional context in comments.

4 Comments

I thought so, BUT I have the problem, that this link I wrote is used as a fixed link. Means that I cannot use urlencode in that case :(
Sorry, my english might not be the best :D I meant that another system uses this link, so it is not a link which could use urlencode().
@AK Then the other system is actually broken, because that link is invalid.
Thank you for all your answers, I will try using urlencode(), even if it is kind of tricky for my case.

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.