您好我正在使用codeigniter和sheepIt克隆表单。(嵌入表单)。
我正在尝试在提交后将数据插入数据库。
当我使用print_r()
时,输出数据采用这种格式Array
(
[project] => Array
(
[0] => Array
(
[module] => Design
[features] => Array
(
[feature_0] => Array
(
[feature] => Login
[Hours] => 10
)
[feature_1] => Array
(
[feature] => Signup
[Hours] => 10
)
)
)
[1] => Array
(
[module] => Development
[features] => Array
(
[feature_0] => Array
(
[feature] => Login
[Hours] => 20
)
)
)
)
[submit] => save
)
我也可以发布sheepIt表格的代码。
答案 0 :(得分:1)
解答:
$arr_data = $this->input->post();
foreach($arr_data['project'] as $prj) {
foreach($prj as $i) {
$arr['module'][] = module = $i['module'];
foreach($i['features'] as $f) {
$arr['feature'][] = $f['feature'];
$arr['Hours'][] = $f['Hours'];
}
}
}
print_r($arr);
使用此处理过的$ arr数据进行存储或其他。