passing variables in url
Posted: Mon Jul 27, 2009 4:41 am
I usually pass variables to my pages through the url like this:
http://www.whatever.com/page.php?var=1
and then I retrieve the variable from page.php like this:
My question is:
Is there a way to pass a variable to my pages through the url like this:
http://www.whatever.com/var
and this not take me to a folder called var?
For instance http://www.myspace.com/tom takes me to Tom Anderson's page whereas http://www.myspace.com/tom/ (notice the / on the end) doesn't exist. Is this something that php supports or is it only available in whatever language myspace is written in. Any help would be appreciated. Thanks.
http://www.whatever.com/page.php?var=1
and then I retrieve the variable from page.php like this:
Code: Select all
if (isset($_GET['var'])) {
// do something
}
Is there a way to pass a variable to my pages through the url like this:
http://www.whatever.com/var
and this not take me to a folder called var?
For instance http://www.myspace.com/tom takes me to Tom Anderson's page whereas http://www.myspace.com/tom/ (notice the / on the end) doesn't exist. Is this something that php supports or is it only available in whatever language myspace is written in. Any help would be appreciated. Thanks.