我在我的 cakephp 应用程序中使用 cakedc 搜索功能。
搜索有一个类别的下拉菜单。我希望根据下拉菜单搜索相应的模型/控制器。
<php echo $this->Form->create('Fashion', array(
'url' => array_merge(array('action' => 'search'), $this->params['pass'])));
echo $this->Form->input('name', array('div' => false, 'empty' => true, 'label'=>''));
echo $this->Form->input('id', array('div' => false, 'empty' => 'All', 'label'=>'', 'class' => 'dropdown_categories',
'options'=>array(array(1 => 'Fashion',
2 => 'Books, Games & Music',
3 => 'Electronic Gadget',
4 => 'Gifts, Toys & Hobbies',
5 => 'Health & Beauty',
6 => 'Homes, Garden & Tools',
7 => 'Sports',
8 => 'Automotives'))));
有了这个编码,它在时尚表中唯一的搜索项目。我有桌子:时装、书籍、电子产品、礼品等等。如何根据下拉菜单更改“ $this->Form->create('Fashion'); ”。
有没有更好的方法来解决这个问题。使用 if else 或 javascript。