title: How to group array and display it in a dropdown in cakephp?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/9597240/how-to-group-values-in-an-array-in-caekphp">How to group values in an array in caekphp?</a>  </p>
  </blockquote>
  
  
  
  <p>I have two array, team leads array and team members array.<br>
  Under each team lead there will be few team members.<br>
  i used to fetch the teammembers with the correspoding team lead id only.<br>
  I need to group them and display it as a <strong>single dropdown</strong> where under each team lead the corresponding team members should be displayed.<br></p>
  
  <blockquote>
    <p>TeamLead1<br>
        TeamMember1<br>
        TeamMember2<br>
        TeamMember3<br>
        TeamMember4<br>
      TeamLead2<br>
        TeamMember1<br>
        TeamMember2<br>
        TeamMember3<br>
        TeamMember4<br></p>
  </blockquote>
  
  <p>i know that we need to use foreach loop, but i got confused and lost.<br>
  Anyhelp would be greatly appreciated.
  Thanks.</p>