【问题标题】:My codeigniter form sends textarea using post, and does not send input type text我的 codeigniter 表单使用 post 发送 textarea,并且不发送输入类型文本
【发布时间】:2013-04-23 08:21:46
【问题描述】:

全部。

我的 Codeigniter 有一个 input type="text" 和一个 textarea。在发送时我可以看到(Chrome 网络资源),$_POST 数组不包括输入类型=“文本”字段,但包括 textarea!我什至尝试将输入更改为 textarea 并且它起作用了...

<form action="news_save" method="post" accept-charset="utf-8"> 

  <label class="control-label span3" for="subj">Subject</label>
  <input type="text" id="subj" name-"subj" class="row-fluid">

  <label class="control-label span3" for="body">Body</label>
  <textarea rows="3" name="body" class="row-fluid" id="body"></textarea>

  <button type="submit" class="btn btn-primary">Save</button>
</form>

有什么建议吗?

【问题讨论】:

    标签: php html codeigniter post input


    【解决方案1】:

    name属性附近的输入文本有问题,而不是-应该是=

    <input type="text" id="subj" name-"subj" class="row-fluid">
    

    改成这个

    <input type="text" id="subj" name="subj" class="row-fluid">
    

    【讨论】:

      【解决方案2】:
      $array= array(namedb' => $this->input->post('body'));
      

      插入到数据库之后。

      $this->ModelFile->MetodModel($array);
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-01-03
        • 1970-01-01
        • 1970-01-01
        • 2021-09-26
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多