Hi My Cakephp friends,
              I am new on this google groupcakephp forum.I spend lot
of time to solve the problem on the forum but still can't get
anything, so can anybody help me regarding following issue.


I have two models(database table):User,Message

I want place a drop down in my Message view file as :

<? echo $form->select('messageto', $options=array(), null, array(),
'--
select member--'); ?>

I want to fills this drop down from my another table (user table)
i.e i want to fill it dynamically from database table.


Also when i edit the message ,the drop down value should be the same
as their id.i.e
it select the proper value (not the first one everytime).

this is my controller file code for Message:

**************************

<?php
class MessagesController extends AppController {

    var $name = 'Messages';
    var $layout='user';


    var $paginate = array(
        'limit' => 4,
        'order' => array(
            'Message.messagedate' => 'asc'
        )
    );




    function index() {
        //$this->set('messages', $this->User->findAll(''));
        $data = $this->paginate('Message');
      $this->set(compact('data'));

    }

    function view($id) {
        $this->Message->id = $id;
        $this->set('Message', $this->Message->read());

    }

    function delete($id) {
    $this->Message->del($id);
$this->flash('The message with id: '.$id.' has been deleted.', 'http://
192.168.0.60/vishal/cake_1.2.0.6311-beta/app/messages/index');
}

    function add() {



            if (!empty($this->data)) {
            if ($this->Message->save($this->data)) {


                $this->flash('Your Message has been saved.','http://
192.168.0.60/vishal/cake_1.2.0.6311-beta/app/messages/index');
            }

        }
    }


    function edit($id = null) {
    $this->Message->id = $id;
    if (empty($this->data)) {
        $this->data = $this->Message->read();
    } else {
        if ($this->Message->save($this->data['Message'])) {
            $this->flash('Your Message has been updated.',
array('action' =>
'index'));
        }
    }
}

}
?>


******************************************************


So my friend please help me in this issue,it is very urgent for me,
otherwise i have to put the
query manually,but i want to fill the dropdown by cake method.

Thanks in advance..!!!!

Vishal
One world Technologies,
Ambala Cantt
India

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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