View Full Version : The Query String
duniyadnd
05-08-2003, 09:15 PM
I understand one of the glorious things about PHP is obtaining data via Query Strings, which starts with a "?"
I tested putting multiple "?" in multiple locations (not including putting it next to the variable value), and there don't seem to be any difference, does the language ignore subsequent "?" and take the variables from the first "?" onwards? Or does it make a difference?
Duniyadnd
I understand one of the glorious things about PHP is obtaining data via Query Strings,
Not a PHP thing. ASP, JSP etc can all do that. In fact i think the get-method is older then PHP.
I tested putting multiple "?" in multiple locations (not including putting it next to the variable value), and there don't seem to be any difference, does the language ignore subsequent "?" and take the variables from the first "?" onwards? Or does it make a difference?
What do you mean ?
duniyadnd
05-08-2003, 10:38 PM
Not a PHP thing. ASP, JSP etc can all do that. In fact i think the get-method is older then PHP.
That's a given, i was trying to add humour, i guess i should stop trying that.. ;)
How??
domain.com/folder/blah.php?some=xyz&thing=yzx&cool=zyx
Would be written as:
domain.com/folder/blah.php??some=xyz&?thing=yzx&?cool=zyx
Duniyadnd
I geuss i'm just to spupid. (could have done with some humour though) Maye, to make things easier on dumb people like me, ad some humor-tags around it.
Anyway. It shouldn't make a difference. Your variablename then simply is "?some" or your value is "what?ever". I know for sure ASP treats it like that, and i suspect php doing the same. (to tiered to trie it out right now)
Grant Palin
05-08-2003, 11:01 PM
I think you only need one "?", immediately after the actual URL, before the query string.
duniyadnd
05-08-2003, 11:02 PM
Yeah, I know I only need one, but I was just curious does more than one change anything?
Duniyadnd
Spookster
05-08-2003, 11:16 PM
I haven't looked it up but I can imagine that the PHP parser will look for a ? and then after that it will look for a variable name and then an equal sign and then a value until it sees a & indicating the start of another variable name. So for example in the codingforums url
http://www.codingforums.com/newreply.php?s=&action=newreply&threadid=19664
after the ? we have the first parameter:
s=
and then the second
action=newreply
and then the third
threadid=19664
If you put additional ?'s in the query string then I imagine they will be treated as part of the variable name or value.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.