On Fri, Jul 31, 2009 at 12:53 PM, Miller,
Terion<[email protected]> wrote:
>
>
>
>
> I have this script that works, just a couple tweeks needed...
>
> 1. I don't want it to default to A being selected
> 2. I need the number range part to only display one # sign not 10 of them,
> somehow I have to have it pull any record that does not start with alpha
>
>
> <?php
> $letter =
> isset($_GET['letter']) ? $_GET['letter'] :"A";
>
> echo '<div
> align="center"><b>';
>
> foreach(range('A','Z') as $c){
> ($letter == $c)
> ?
> printf('%s ',$c)
> : printf('<a
> href="browse.php?letter=%s">%s</a> ',$c,$c);
> }
>
> echo '<br>';
> //Other
>
>
> foreach(range('0','9') as $n){
> ($letter == $n)
> ?
> printf('%s ',$n)
> : printf('<a
> href="?letter=%s">#</a> ',$n,$n);
> }
>
> echo
> "</b><br></div><p>";
>
> ?>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
How about
<?php
$letter = isset($_GET['letter']) ? $_GET['letter'] :"";
echo '<div align="center"><b>';
foreach(range('A','Z') as $c){
($letter == $c) ? printf('%s ',$c) : printf('<a
href="browse.php?letter=%s">%s</a> ',$c,$c);
}
echo '<br>';
//Other
$bNumberShown = false;
foreach(range('0','9') as $n){
if($letter == $n) {
printf('%s ',$n)
}else{
if ($bNumberShown){
printf('<a href="?letter=%s">%s</a> ',$n,$n);
}else{
printf('<a href="?letter=%s">#%s</a> ',$n,$n);
$bNumberShown = true;
}
}
echo "</b><br></div><p>";
?>
--
Bastien
Cat, the other other white meat
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php