homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

A-Z List with Active/Inactive letters

 6:12 pm on Jun 7, 2010 (gmt 0)

I have to produce a set of tabs number starting with one for numbers 0-9, and then a tab for each letter of the alphabet A-Z. These will list product groups, with the tabs activated (and linked) where products starting with the letter exist, and then greyed-out if no products exist.

I'm happy with getting the list of 'active' groups from the datebase using the following query...

"SELECT DISTINCT UPPER(LEFT(ht_Groups,1)) as letters FROM ProdGroups ORDER BY letters"

However, I can't figure how to get the results into an array that will help me identify which of the tabs should be active, and which should be inactive.

Can anyone help me please. Thanks in anticipation.



 6:59 pm on Jun 7, 2010 (gmt 0)


Take a look at this example:
$active = array('B', 'F', 'T');
$all = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
foreach($all as $a){
if(in_array($a, $active)){
echo '<a href="#">', $a, '</a>';
echo $a;
echo '<br>';


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved