i want to fill a selection list based on a table of data called Region.
It has two columns, id and region (containing the actual name of the
region).
To do this i wrote code below. Is there a faster, less convoluted way?
This seems like a common task and should be an easier way. Thanyou.
?php
Controller:$this-set('region_list', $this-Region-generateList());View:?php echo $html-selectTag('Custome/region',$region_list) ?By default the above code looks for id and name in the database table.
To change this set var $dsiplayField = 'region'; in your Region
yes generateList() ;)
I use it that way in my code, it should put you on the way:
controller:
$this-set('categories', $this-Post-Category-generateList());
$this-set('selected_category',
$this-params['data']['Category']['id']);
view:
?php echo
fantastic! thanks alot
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]