0
产生我在控制器CakePHP中,选择了形式与查询
$clientslist = $this->Client->query("SELECT client_name FROM clients WHERE active=1");
我该怎么让我的客户名单与在表单中选择此查询?
echo $this->Form->input('clientname', array('type' => 'select', 'options' => ??????));
感谢
编辑
我已经解决了我的问题
在控制器
$clientslist = $this->Client->find('list', array('fields' => array('Client.client_name'), 'conditions' => array('Client.active' => '1')));
$this->set('clientslist', $clientslist);
鉴于
echo $this->Form->input('cliente', array('type' => 'select', 'options' => $clientslist));
我还有一个问题,现在
鉴于选择框的每一个选项的值是id 我怎样才能在价值使用客户端的名字吗?
与我的查询我得到''选项值=“4”>苹果',与你我''选项值=“4”> 4'但我需要'' – Matteo 2011-05-02 09:06:20