doushouhe7072 2016-12-14 18:40
浏览 29

代码点火器:由于验证而未发布数据

 <?php  

if (isset($_POST['submit'])) {
$task = $_POST['name'];
$count = $_POST['choice'];
$order = $db->prepare("INSERT INTO `Dreams` (Choice, Name) VALUES   
('$count', '$task')");
$order->execute();
}

 ?>

I'm trying to submit information from a form input on a View in code igniter. This code above is at the end, and should submit name and choice.

 if ($this->form_validation->run() == FALSE)
            {
                    $this->load->view('bar');
                 echo validation_errors(); 
            }
            else
            {
                   $this->load->view('formsucess');

            }

These lines of code are in my controller which begin validation. The problem I'm having is that the first set of code is not executing, and actually pushing the data to the server(the connection and info are all correct, being verified at the beginning of the view's code that establishes the connection). I believe it's because the controller tries to validate before the view can actually push the form data to the database. How do I reconcile this without having to make too many drastic changes?

  • 写回答

1条回答 默认 最新

  • dsfs64664 2016-12-16 01:10
    关注

    My issue was outside of my question. Focused too hard on these aspects to not see that the forms input value was "Submit Form" and not "submit"

    <input type "submit" name "submit" value "Submit Form"> <--- wrong
    <input type "submit" name "submit" value "submit"> <---- correct
    
    评论

报告相同问题?

悬赏问题

  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)