On 8/3/09 12:26 PM, "Miller, Terion" <tmiller@xxxxxxxxxxxxxxxxxxxx> wrote: All of a sudden this stopped working and keeps defaulting to A again if ($_SERVER['SCRIPT_FILENAME'] = "browse.php" ) { $default = "A"; } else { $default = ""; } I was using the above successfully until the boss rewrote the script now it defaults to the A's again....and that script_filename doesn't work... <?php //alphabetical pagination links //if the page is browse default to A's if on other pages just show pagination links and not default listings //Create array with letters AND number sign $letters = range('A','Z'); array_push($letters, 'nums'); $menu = ''; $selectedLetter = isset($_GET['letter']) ? $_GET['letter'] : NULL; foreach($letters as $letter) { if($letter == $selectedLetter && $selectedLetter != 'nums') { $menu .= sprintf('%s ', $letter); } else if($letter == $selectedLetter && $selectedLetter == 'nums') { $menu .= sprintf('%s ', '#'); } else { if($letter == 'nums') { $menu .= sprintf('<a href="browseMatt.php?letter=%s">%s</a> ', 'nums', '#'); } else { $menu .= sprintf('<a href="browseMatt.php?letter=%s">%s</a> ', $letter, $letter); } } } echo "<div align=\"center\"><b>{$menu}</b><br /></div>"; //Show all restaurants that start with $letter not between "A" and "Z" if ($selectedLetter == "nums") { for($i = 0; $i <= 9; $i++) { $sql = "SELECT DISTINCT ID, name, address FROM restaurants WHERE name LIKE '$i%'"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { $name = $row['name']; printf('<a href="view.php?ID=%s"><b>%s</b><br />%s<br /><br /></a>', $row['ID'], $row['name'], $row['address']); } } } else { $sql = "SELECT DISTINCT ID, name, address FROM restaurants WHERE name LIKE '$selectedLetter%'"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { $name = $row['name']; printf('<a href="view.php?ID=%s"><b>%s</b><br />%s<br /><br /></a>', $row['ID'], $row['name'], $row['address']); } } ?> -- 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