+ -
当前位置:首页 → 问答吧 → 添加不到数据库

添加不到数据库

时间:2011-10-01

来源:互联网

表单:
<form action="__URL__/add" method="POST">
               
<p class="long_input"><input type="text" name="title" value="标题:" /></p><br>
               
<input type="radio" name="type" value="news" checked="checked" />最新新闻
               
<input type="radio" name="type" value="announce" />最新公告

<input type="radio" name="type" value="advance" />资源优势

<input type="radio" name="type" value="network" />营销网络

<input type="radio" name="type" value="products" />产品介绍<br>
                    <p id="neirong"><textarea name="content">内容:</textarea></p>
                    <p id="submit"><input type="submit" value="提交" /></p>
  </form>
方法:
                function add(){
                        $article=M('article');
                        $data['type']=$_POST['type'];                       
                        $data['title']=$_POST['title'];
                        $data['content']=$_POST['content'];
                        dump($data);
                        if($alist=$article->create()){
                                dump($alist);
                        }
}
结果就是这样的,不知道为什么type字段dump不出来?
array
  'type' => string 'announce' (length=8)
  'title' => string '1111111' (length=7)
  'content' => string '222222222222222' (length=15)

array
  'title' => string '1111111' (length=7)
  'content' => string '222222222222222' (length=15)

作者: leandre   发布时间: 2011-10-01

name="type[]"

作者: ck52110u   发布时间: 2011-10-01