homepage Welcome to WebmasterWorld Guest from 54.196.69.189
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Visit PubCon.com
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
Tourex




msg:4148285
 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.

 

Little_G




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

Hi,

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>';
}
else{
echo $a;
}
echo '<br>';
}


Andrew

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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved