Sam is right in that you should be running $this->City->find('list');

That will automatically pull the id and name columns from your cities
table, if you do not have a name column then you need to supply a
fields array to tell it which alternative field to use for name.

http://book.cakephp.org/view/810/find-list

Sam is also right that the plural of City is cities, and as such make
sure your controller is called cities_controller.php and your table
cities.

I'm assuming you're then saving the city_id into another table, if so
and you want to use Cake's automagic to add a select list to the form
then the variable you send to the form view needs to be called $cities
and the form input would be called by simply adding

$form->input('ModelName.city_id');

The form helper will automatically look for the existance of a $cities
array and use that to build the options list checking for the current
calue of city_id and selecting the right option in the list if one has
already been selected.

HTH

Paul.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to