The following article is an explantion on query strings
<?php http://www.yoursite.com/page.php?url=portfolio ?>
'query string' is the ?url=portfolio part in 'page.php?url=portfolio'. url=portfolio is called a variable/value pair. You can seperate them by using an '&' ampersand EX: 'page.php?var1=gallery&var2=3d'.
That is what a query string is, but how does PHP read this you ask? Read on.
we use the $_GET array!
The GET array is used in place of the original variable.
print $_GET['url'] . '<br />'; print $_GET['id'] . '<br />'; print $_GET['page'] . '<br />';
That is an example $_GET array being printed in PHP
This is the most common use of query strings, but that example is highlighting an extremely dangerous way of doing it. Check out the Secure Navigation tutorial here for more info.
Now you should understand how Query Strings work.
Gixboy Sun Jan 29, 2006 6:17 pm
Thank you a lot. This is the first place that I've found, including Barnes and Noble at my downtown mall, that could give me a simple, to-the-point tutorial on query strings in php. This has made my links go a lot faster, and it saves me annoying "Page Cannot Be Displayed"'s. Good job.
mkeefe Wed Feb 1, 2006 8:25 pm
Glad that the tutorial helped you out. It is always nice to hear comments back from the readers. :)
somone Mon Oct 8, 2007 3:11 am
hi, thanks for help
Validate Site: XHTML CSS | Designed by: Matthew Keefe of mkeefeDESIGN