表单提交 多个name相同的input

<form action="{:U('Index/test')}" method="post">
<foreach name="div" item="vo">
组名:<input type="text" value="{$vo.groupName}" name=gp[]><br><br>
用户名:<input type="text" value="{$vo.username}" name=user[]><br><br>
</foreach>
<input type="submit">
</form>
<?php
// 本类由系统自动生成,仅供测试用途
class IndexAction extends Action {
    public function index(){
    $this->display();
    }
    public function group(){
        header("Content-Type:text/html; charset=utf-8");
$User = M("groupuser");    // 实例化模型类
$data = $User->select();
$this->assign('div',$data);
$this->display('Index/index');
//dump($data);
    }
public function test(){
$Index = A('admin://Index');
$gp=$_POST['gp'];
$user=$_POST['user'];
dump($gp);
dump($user);
}

}

 

posted @ 2014-12-11 13:50  fleam  阅读(2295)  评论(0编辑  收藏  举报