I posted this in the PPVFormula forum but I think it’svaluable on its own and might help some people so…. here it is on my blog.
First – what does the word “query” mean?
It means “question”, right?
So literally, the query string is a “question string” and therefore must start with – you guessed it, a QUESTION mark!
So a query string MUST always start with ? like this:
Now, if you were asking someone two or more questions at the same time, how would you do so?
You might say something like…
“What’s black and blue and read all over?”
Which could also be phrased as:
“What’s black & blue & red all over?”
See the “and” symbols – aka “ampersands”? They LITERALLY mean “and”! So your “question string” must start with a question mark, and then use & symbols for the additional bits you want to ask about. Such as…
You are literally saying:
“subid is whatever and sub2 is something-else and sub3 is whatever3”.
It’s pretty much plain english, slightly abbreviated.
Just remember that it always STARTS with the question mark… much like Spanish does for example (Spanish starts AND ends with a question mark however…) A query string can NOT start with an ampersand, as no “query” has happened yet. So this is NOT valid:
Now for the technical amongst us, the subid itself is actually called a “key” and what you put IN the subid is known as a “value”, so you may have seen these referred to as “key/value pairs”.
Also for the technical/coders in the group, all query string subids are always stored in the $_GET array in PHP, for you to do whatever you want with.
I don’t want to lose anyone so I’ll stop here. Hopefully the above helps you to remember how to format a URL query string easily any time you need to do so. 🙂