954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

url variable name itself has space in it... how can I retrieve it in php??

url variable name itself has space in it... how can I retrieve it in php??

Hi, I got this problem, where I need to capture get url variable pairs, but these are coming from an automatically created javascript and has this format:
page?custom zip=33021&custom city=boston... and so on...

If you notice the actual variable-names have spaces in it (custom zip, custom city; as opposed to normally named customzip, customcity) and when i try to capture them in php like this:
<?php echo $_GET['custom zip']; ?>

it doesnt do it... But if I manually change my url and join the variables like this: "customzip=33021" and change php accordingly, then it echoes it with no problem!

So I think is cause php doesnt like the actual variable to have spaces in it.. so how do I get to read it??

thanks, appreciate feedback...

websurfer
Junior Poster in Training
65 posts since Mar 2007
Reputation Points: 10
Solved Threads: 0
 

Remove the space, the url variable is still a variable, never put spaces in variables.

ShawnCplus
Code Monkey
Team Colleague
1,583 posts since Apr 2005
Reputation Points: 526
Solved Threads: 268
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You