Cakephp 如何选择一个选择框选项的显示,然后我需要显示第二个选择框

Cakephp 如何选择一个选择框选项的显示,然后我需要显示第二个选择框,cakephp,Cakephp,这里我粘贴了选择框的代码 echo $this->Form->input('accounttype', array( 'options' => array('Doctor','Patient') //here 0 means doctor 1 means patient )); 如果在这里我选择了一个选项医生 然后只显示第二个选择框,否则不会显示 if($user['accouttype']== 0){ echo $this->Form-

这里我粘贴了选择框的代码

echo $this->Form->input('accounttype', array(
    'options' => array('Doctor','Patient') //here 0 means doctor 1 means patient
    ));
如果在这里我选择了一个选项医生 然后只显示第二个选择框,否则不会显示

if($user['accouttype']== 0){
        echo $this->Form->input('specality', array(
    'options' => array('Anesthesiologist','Emergency medicine','Family medicin','General surgery') //here 0 means doctor 1 means patient
    ));

它可以使用AJAX完成,可以归结为一些jQuery和一些蛋糕

看看 这就解释了你如何在这里以一种干净的方式利用蛋糕

沙箱中还有一个实时工作示例代码: -代码