> I've been searching php.net for a function to do this: > > if page_url('browse.php') { The $_SERVER global array has this sort of information. The 'PHP_SELF' key might be what you want: http://us.php.net/manual/en/reserved.variables.server.php But where is the code that needs to know? I'm guessing it's in a common library file that's going to be included in browse.php as well as other scripts, but am I guessing rightly? BTW, you could simplify your code slightly by defining $default as an empty string before the IF block. Then you only have to read from $_GET once. <?php $default = ""; if (<url condition>) { $default = "A"; } /* * No need for an "else" any more, now you can just * set the value of $letter */ ?> I'd also suggest using filter_input() rather than reading directly from $_GET: <?php $letter = filter_input(INPUT_GET, 'letter', <filter>, [<options>]); if (empty($letter)) { $letter = $default; } ?> Presumably you'd want to use FILTER_VALIDATE_REGEXP in place of "<filter>" and, for "<options>", pass a regex that ensures that 'letter' is a single alphabetical character. You can read about the filter functions here (sort of, the documentation is a little sparse): http://us.php.net/manual/en/ref.filter.php A VALIDATE_REGEXP example is available here: http://www.w3schools.com/php/filter_validate_regexp.asp Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php