我在cakephp中创建了一个下拉列表,如下所示:
$city_list = $form->select("GalStore.gal_location_id", $gal_locations,null,$city_attributes);
现在我需要以数组形式发送列表名称,即<select name="mylist[]">
格式。
我尝试将[]
放在上面的变量中:
$city_list = $form->select("GalStore.gal_location_id[]", $gal_locations,null,$city_attributes);
但它产生HTML
为:
<select name="data[GalStore][gal_location_id[]]">
我怎样才能实现它?
答案 0 :(得分:0)
我不确定你究竟在寻找什么,但这会给你一般的想法。
$city_list = $form->select("GalStore.gal_location_id.0", $gal_locations,null,$city_attributes);
// or
$city_list = $form->select("GalStore.0.gal_location_id", $gal_locations,null,$city_attributes);
根据需要更改0
。