ForEach Range Problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




    

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&nbsp',$c)
                                                            : printf('<a
href="browse.php?letter=%s">%s</a>&nbsp;',$c,$c);
                                                        }
                   
                                                        echo '<br>';
                                                        //Other
                   
                   
foreach(range('0','9') as $n){
                                                          ($letter == $n)
                                                        ?
printf('%s&nbsp',$n)
                                                        : printf('<a
href="?letter=%s">#</a>&nbsp;',$n,$n);
                                                      }
                   
                                                        echo
"</b><br></div><p>";

                              ?>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux