0

i'm trying to get 2 url parameters using this code:

$page = htmlspecialchars($_GET["page"]);
$category = htmlspecialchars($_GET["category"]);

and the result i get looks like this:

leaderboard?category=any%

and the url looks like this:

?page=leaderboard?category=any%

How do i get both results now?

Cheers, Chris.

3
  • Did you try use parse_url function? php.net/manual/en/function.parse-url.php Commented Aug 13, 2018 at 20:25
  • Could you explain a little bit better? And first of all when you pass the parameters through GET you should be doing like this: ?page=leaderboard&category=any Commented Aug 13, 2018 at 20:25
  • htmlspecialchars is not for URLs. How are you using the variables you defined? Commented Aug 13, 2018 at 20:27

2 Answers 2

2

try this (&) instead of this (?) . Example below

?page=leaderboard&category=any%
Sign up to request clarification or add additional context in comments.

2 Comments

@ChrisCordes - Please accept answer and vote up then :)
Thanks i appreciate it :)
1

The first query string (URL Parameter) always starts with question mark (?) sign and rest of them with ampersand (&) sign so the URL should be

?page=leaderboard&category=any%&anythingelse=value

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.