0
数据库是这样的。老板有很多猫。cakephp中的下拉列表
所有者 OWNERID OWNERNAME
猫 CATID catType OWNERID
我尝试添加新的猫和OWNERID领域,我想告诉所有的OWNERNAME的droplist。我怎样才能做到这一点?
数据库是这样的。老板有很多猫。cakephp中的下拉列表
所有者 OWNERID OWNERNAME
猫 CATID catType OWNERID
我尝试添加新的猫和OWNERID领域,我想告诉所有的OWNERNAME的droplist。我怎样才能做到这一点?
我假设你已经有了主人模式,为业主的下拉列表
在Conrtoller
$Owner = $this->Owner->find('list', array('fields' => array('Owner.ownerID', 'Owner.ownerName')));
$this->set('owners', $owner);
在查看
<?php echo $form->input('owner', array(
'label' => false,
'id' => 'owner_id',
'options' => $owners
)); ?>
写在你的位指示:
$all_security_question = $this->Security_question->find('list',array('fields'=>array('id','question')));
$this->set("all_security_question",$all_security_question);
Write in your Model:<?php echo $this->Form->input('security_question_id', array(
'label' => false,
'id' => 'id',
'options' =>$all_security_question
)); ?>
你有模型的主人和猫? –
实际上我不在这些数据库上工作。我只是想把简单的数据库图片。 – soe
你必须为所有者创建一个模型 –