View Full Version : PHP get question
wibumba
08-06-2008, 04:44 AM
I'm making my php script display a page based on a get variable. I know I can do this by (for instance) "index.php?page=pics", but I remember seeing a script a month ago (I forget which site and how I found it) that retrieved a value from a URL like this "index.php?pics". How exactly would I do that?
You can parse $_SERVER['QUERY_STRING'], or alternatively (less flexible) simply check for isset($_GET['pics']).
wibumba
08-06-2008, 06:11 AM
Ah yes, that's the one. Thanks.
Oh, perhaps better than parsing QUERY_STRING:$s = array_keys($_GET); // PHP doesn't allow us to do array lookup without an intermediate variable.
$s = @$s[0];
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.