Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

A-Z List with Active/Inactive letters



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

10+ Year Member

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)

5+ Year Member


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>';


Featured Threads

Hot Threads This Week

Hot Threads This Month