I know this been posted before, but I can't find it.
How does the PHP $_GET -function works?
On my site I want a parameter like ?p=home, ?p=about and so.
Can anyone post a "tutorial" or give me a link to another post where this is described?
-- Erik™
$_GET gets populated with variables and values passed by GET instead of by POST, which in your browser is often show as URL variables.
So if you want ?p=home, ?p=about, etc you can simply do:
if ($_GET['p'] == 'home')
// do something
else if ($_GET['p'] == 'about')
// Do something else
else
// Do something when nothing is specified.
Okay, thanks.
I thought it was like that, but wasn't sure
-- Erik™
While we are on the subject. Is there a difference between $_GET and $_REQUEST?
Lainaus käyttäjältä: http://www.php.net/manual/en/reserved.variables.phpAn associative array consisting of the contents of $_GET, $_POST, and $_COOKIE.