title: Cake PHP Select to Dropdown
body: <p>I'm newbie with CakePHP and need some help.  I baked my first application but I'm not able to make it behave as I want.</p>
  
  <p>I have two tables, players and teams, and a join table players_teams.  The form displays fine.  But I would like to change the select area to a drop down menu.  The player could have many teams over time (I added a from and a to date columns to the join table for that), but I would like the player to be assigned to one team at the moment it is created.</p>
  
  <p>Here is what I have tried:</p>
  
  <pre><code>&lt;?php
  echo $this-&gt;Form-&gt;input('player_name');
          echo $this-&gt;Form-&gt;input('player_last_name');
          echo $this-&gt;Form-&gt;input('player_number');
          echo $this-&gt;Form-&gt;input('player_birthday');
          echo $this-&gt;Form-&gt;input('teams._ids', [ 'multiple' =&gt; false, 'options' =&gt; $teams,]);
      ?&gt;
  </code></pre>
  
  <p>It does not change to a dropdow. I have also tried this:</p>
  
  <pre><code>echo $this-&gt;Form-&gt;input('teams._ids',  ['type' =&gt; 'select', 'multiple' =&gt; false, 'options' =&gt; $teams, 'empty' =&gt; true]);
  </code></pre>
  
  <p>This last one change the select to a dropdown, but whatever I select doesn't go to the database.</p>
  
  <p>Heres the Controller for Players:</p>
  
  <pre><code>public function add()
  {
      $player = $this-&gt;Players-&gt;newEntity();
      if ($this-&gt;request-&gt;is('post')) {
          $player = $this-&gt;Players-&gt;patchEntity($player, $this-&gt;request-&gt;data);
          if ($this-&gt;Players-&gt;save($player)) {
              $this-&gt;Flash-&gt;success(__('The player has been saved.'));
              return $this-&gt;redirect(['action' =&gt; 'index']);
          } else {
              $this-&gt;Flash-&gt;error(__('The player could not be saved. Please, try again.'));
          }
      }
      $teams = $this-&gt;Players-&gt;Teams-&gt;find('list', ['limit' =&gt; 200]);
      $this-&gt;set(compact('player', 'teams'));
      $this-&gt;set('_serialize', ['player']);
  }
  </code></pre>
  
  <p>Here's the PlayersTeamController:</p>
  
  <pre><code>public function add()
  {
      $playersTeam = $this-&gt;PlayersTeams-&gt;newEntity();
      if ($this-&gt;request-&gt;is('post')) {
          $playersTeam = $this-&gt;PlayersTeams-&gt;patchEntity($playersTeam, $this-&gt;request-&gt;data);
          if ($this-&gt;PlayersTeams-&gt;save($playersTeam)) {
              $this-&gt;Flash-&gt;success(__('The players team has been saved.'));
              return $this-&gt;redirect(['action' =&gt; 'index']);
          } else {
              $this-&gt;Flash-&gt;error(__('The players team could not be saved. Please, try again.'));
          }
      }
      $players = $this-&gt;PlayersTeams-&gt;Players-&gt;find('list', ['limit' =&gt; 200]);
      $teams = $this-&gt;PlayersTeams-&gt;Teams-&gt;find('list', ['limit' =&gt; 200]);
      $this-&gt;set(compact('playersTeam', 'players', 'teams'));
      $this-&gt;set('_serialize', ['playersTeam']);
  }
  </code></pre>
  
  <p>Any help will be really appreciated. Thanks!</p>