Thanx for replying. I tried,
$data = $this->Country->findAll(); print_r($data); all the countrynames are being displayed. if i try, $this->set('country', $data). pr($data); only blank array is displayed. further i want to know how to display it in the views. On 5/29/07, majna <[EMAIL PROTECTED]> wrote: > > > > $data = $this->Country->generateList(); # (countries table have name > and id fields) > $this->set('country', $data). > pr($data); > > > On May 29, 10:06 am, cake_learner <[EMAIL PROTECTED]> wrote: > > I want to populate a select tag with country names. The names are in > > the database. The code i have written is: > > > > models: client.php > > > > <?php > > class Client extends AppModel > > { > > var $name='Client';} > > > > ?> > > > > models: country.php > > <?php > > class Country extends AppModel > > { > > var $name='Country'; > > > > } > > > > ?> > > > > controllers: > > > > <?php > > class ClientsController extends AppController > > { > > var $name = 'Clients'; > > > > var $uses = array('Clients', 'Country'); > > > > function index() { > > > > if (!empty($this->data)) > > { > > if ($this->Client->save($this->data)) > > { > > $this->flash('Your post has been saved.','/clients/ > > register2'); > > } > > } > > > > } > > > > function register2() > > { > > // echo $this->Country; getting error: > > } > > > > } > > > > ?> > > > > > --~--~---------~--~----~------------~-------~--~----~ 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] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---