On Tuesday 02 November 2004 13:32, Merlin wrote: > I am retrieving some values out of the db and would only like to show those > available inside a drop down field. Now I do have 2 arrays which fill the > drop down field and one array with the values which should only show up. > > Example: > $objects_available = array(3,5,7); > > > $ob_options = array( 'all available', 'accomodations', 'internet access', > 'tour operators', 'restaurants' , 'pubs', 'clubs', 'museums', 'secret > spots', 'hotels at the airport'); > > $ob_values = array( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9); > > Has anybody an idea how to filter just the ones out which are inside the > objects available array? I am sure this is possible without any if > statements, but just cant come up with a clear programming solution. Assuming that '0' corresponds to 'all available', '1' to 'accomodations' etc, then: foreach ($objects_available as $key) { echo $ob_options[$key]; } -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* There are three kinds of people: men, women, and unix. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php