passing variables in url

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gth759k
Forum Commoner
Posts: 76
Joined: Mon Jun 15, 2009 3:04 am

passing variables in url

Post by gth759k »

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:

Code: Select all

 
if (isset($_GET['var'])) {
       // do something
}
 
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.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: passing variables in url

Post by VladSun »

There are 10 types of people in this world, those who understand binary and those who don't
Post Reply