Guys I need help in extracting data from a table.

eg.
SAM PAM PAT
TEAM01 X X
TEAM02 X X
TEAM03 X X


I want to know what are the teams in which sam a member. Peoples' names should be selected from a dropdown menu and names of the teams should be displayed below the menu in alphabatical order.

Can u guys help me?