I have seen some PHP scripts receiving information as part of the URL, for example:
Could you please let me know the name of this technique?
Also, when should I use this?
Finally, I'd appreciate if you could recommend a tutorial for me to learn how to use it.
Thanks a lot!!
It's a query string.
Query strings are used as part of the url to pass data from a client-side page to a server-side script, typically via a form.
Query strings are composed of a series of field/value pairs. The question mark is used as a separator and is not part of the query string.
Take Google as an example:
If I go to google.de and type in "sitepoint" then click "Search", on the results page the url will be https://www.google.de/search?q=sitepoint
This means that when it receives my request, Google's server will examine the contents of the "q" field, to find out what I searched for.
In PHP you would access this like so:
$searchTerm = $_GET["q"];
The reason Google uses this method is so that searches can be bookmarked.
This topic is now closed. New replies are no longer allowed.