Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

url parameters with a space in the variable name

Question posted by: goobla (Guest) on March 18th, 2008 02:45 AM
Hello,

I am having an issue that is being sent to one of my scripts. A
particular company likes to uses spaces in their url parameters, which
is causing me some issues.

For example:
A url variable might be "custom var" with a value of "1234"
and "custom var2" with a value of "5678"
they are sending this as:

test.php?custom%20var=1234&custom%20var2=5678

I am having trouble accessing this variable.

Things i have tried:
$_GET["uid"]
$_GET["custom uid"]
$_GET["custom%20uid"]
$uid
$_REQUEST["custom uid"]
$_GET['custom uid']

You guys get the idea.

How do i reference these variables?

Thanks.
goobla's Avatar
goobla
Guest
n/a Posts
March 18th, 2008
02:55 AM
#2

Re: url parameters with a space in the variable name
EDIT:
Quote:
Things i have tried:
$_GET["var"]
$_GET["custom var"]
$_GET["custom%20var"]
$var
$_REQUEST["custom var"]
$_GET['custom var']


goobla's Avatar
goobla
Guest
n/a Posts
March 18th, 2008
03:55 AM
#3

Re: url parameters with a space in the variable name
I can answer my own question.
$custom_var works. use the underscore instead of space or %20

On Mar 17, 10:54*pm, goobla <goog-...@shadowbrew.comwrote:
Quote:
EDIT:
>
>
>
Quote:
Things i have tried:
$_GET["var"]
$_GET["custom var"]
$_GET["custom%20var"]
$var
$_REQUEST["custom var"]
$_GET['custom var']- Hide quoted text -

>
- Show quoted text -



 
Not the answer you were looking for? Post your question . . .
189,846 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors