...

View Full Version : GET value without the variable name and equal sign in URL



eapro
05-10-2009, 11:01 AM
I've seen links like this: http://example.com/hello.php?4495

as you can see, there is no variable name or equal sign in the above URL. Normally it would be like this:
http://example.com/hello.php?v=4495

Now in my hello.php script, how can I get the value 4495 even if the user entered the url without the equalsign or variable name?

abduraooft
05-10-2009, 01:53 PM
preg_match('/[0-9]+/',$_SERVER['REQUEST_URI'],$match);
print_r($match);

kbluhm
05-10-2009, 05:26 PM
echo $_SERVER['QUERY_STRING']; // 4495



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum