How to make a CakePHP drop down list
<p>I have searched this question a lot on here and none of the recognised answers are working for me. I want to populate a select drop down list in my view from another model. For some reason at the moment only the last record is displayed. I have one working solution but the code is long and ugly and i know there must be a better way. In my EventsController i have the following code</p>

<pre><code>$this-&gt;loadModel('Guests');
$this-&gt;set('Guests', $this-&gt;Guests-&gt;find('All',array('fields'=&gt;array('first_name'))));
</code></pre>

<p>As far as i understand this creates a variable called Guests that is an array containing the first names of the guests to an event. Then in my Events/index.ctp i have the following code to create a drop down list. The first example works but is long and ugly. The next three examples are all answers i have found on here but none of them are giving the desired out put. Examples 2 and 3 only show the last record in the table and example 4 displays nothing. </p>

<pre><code>&lt;---- This works ----&gt;

&lt;select&gt;
    &lt;?php foreach ($Guests as $Guests){ ?&gt;
 1        &lt;option value = "&lt;?php echo $Guests['first_name'];?&gt;"&gt;  &lt;?php echo $Guests['first_name'];?&gt;&lt;/option&gt; &lt;?php } ?&gt; 
&lt;/select&gt;

&lt;!--This does not work--&gt;

   &lt;?= $this-&gt;Form-&gt;create('Guests'); ?&gt;

 2 &lt;?= $this-&gt;Form-&gt;select('Guests', ['options' =&gt; $Guests['first_name']]);  ?&gt;

 3 &lt;?= $this-&gt;Form-&gt;input('Guests', array('options' =&gt; array('Guests' =&gt; $Guests['first_name']))); ?&gt;

 4 &lt;?= $this-&gt;Form-&gt;input('Guests', array('options' =&gt; $Guests)); ?&gt;

  &lt;?= $this-&gt;Form-&gt;end(); ?&gt;
</code></pre>

<p>I can see that the variable is being passed from the EventsController by viewing the variables with the cakePHP toolbar. I have included a screenshot of this for conformation. <a href="http://i.stack.imgur.com/tob8L.png" rel="nofollow">Screenshot of variables here</a>. As i am new to cakePHP i would appreciate someone guidance on where the problem is. Thank you in advance. </p>