$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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to