我在codeigniter中有一个下拉表单,工作正常。当我提交表单时,我会看到网址
domain.com/main/search
现在我想通过分段网址传递饮品类型,如下线
domain.com/main/search/fanta
你可以帮助我这么做吗?请参阅下面我的观点:
echo form_open("main/search");
$data = array(
"" => "Select Drink",
"cola" =>"cola",
"fanta" =>"fanta",
"sprite" =>"sprite");
echo form_dropdown('drink', $data, set_value('drink'));
echo form_submit("search", "Search");
echo form_close();
答案 0 :(得分:1)
你可以做的就是编写一个脚本来动态生成动作,就像这样
$resolver->setNormalizers(array('choice_attr', function($options, $value) use ($propertyAccessor){
$extraValue = $options['extra_property'];
return function($choice, $key) use ($extraValue, $propertyAccessor){
// now you have access the to $options['extra_property'], do what you want with it.
}
}