View Full Version : PHP get question
wibumba
08-06-2008, 03: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, 05: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];
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.