Re: [PHP] Re: Page or URL function? (RESOLVED)
I Figured it out using this: if ($_SERVER['SCRIPT_FILENAME'] = browse.php ) { $default = A; } else { $default = ; } $letter = isset($_GET['letter'])? $_GET['letter'] :$default ; On 7/29/09 4:34 PM, Ben Dunlap bdun...@agentintellect.com wrote: Ben Dunlap wrote [TWICE]: The $_SERVER global array has this sort of information. The 'PHP_SELF' key [8] Ben Very sorry for the double-post. Reply-all in Thunderbird News seems a little overzealous by default. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Page or URL function? (RESOLVED)
Miller, Terion wrote: I Figured it out using this: if ($_SERVER['SCRIPT_FILENAME'] = browse.php ) { $default = A; } else { $default = ; } $letter = isset($_GET['letter'])? $_GET['letter'] :$default ; unless you are doing more then what you are showing above. I would do it like this: if ( $_SERVER['SCRIPT_FILENAME'] = 'browse.php' ) { if ( isset($_GET['letter']) ) { $letter = $_GET['letter']; } else { $letter = 'A'; } } else { $letter = ''; } Basically, it is the same thing. But it doesn't execute the additional IF statement when it doesn't need to. Jim On 7/29/09 4:34 PM, Ben Dunlap bdun...@agentintellect.com wrote: Ben Dunlap wrote [TWICE]: The $_SERVER global array has this sort of information. The 'PHP_SELF' key [8] Ben Very sorry for the double-post. Reply-all in Thunderbird News seems a little overzealous by default. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Page or URL function? (RESOLVED)
Jim Lucas wrote: Miller, Terion wrote: I Figured it out using this: if ($_SERVER['SCRIPT_FILENAME'] = browse.php ) { $default = A; } else { $default = ; } $letter = isset($_GET['letter'])? $_GET['letter'] :$default ; unless you are doing more then what you are showing above. I would do it like this: if ( $_SERVER['SCRIPT_FILENAME'] = 'browse.php' ) { if ( isset($_GET['letter']) ) { $letter = $_GET['letter']; } else { $letter = 'A'; } } else { $letter = ''; } Basically, it is the same thing. But it doesn't execute the additional IF statement when it doesn't need to. They end up slightly different. In your version, Jim, only the page 'browse.php' will examine the GET-parameter called 'letter'. In Terion's version, any page with this code in it will examine the 'letter' parameter. Either one might be appropriate, depending on the context, but they don't have quite the same effect. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php