duanliao5995 2016-01-31 21:04
浏览 32
已采纳

制作代码点火器登记表[关闭]

So I am making a form for people to register but its not working, and for some reason my debugger in netbeans is not working so I cannot check properly.

This is the html form

<?php

        if(validation_errors() != false) 
        { 
            echo '<div class="form-group alert alert-danger alert-box has-error">';
                echo'<ul>';
                    echo validation_errors('<li class="control-label">', '</li>');
                echo'</ul>';
            echo '</div>';   
        }

        /* form-horizontal */

       echo form_open('main/insertInformation'); 

        ?>

    <div class="form-group">
        <input type="text" name="name" class="form-control input-lg" placeholder="Name">
    </div>
    <div class="form-group">
        <input type="email" name="email" class="form-control input-lg" placeholder="Email">
    </div>
    <div class="form-group">
        <input type="text" name="phone" class="form-control input-lg" placeholder="Phone">
    </div>
    <div class="form-group">
        <input type="password" name="password" class="form-control input-lg" placeholder="Password">
    </div>
    <div class="form-group">
        <input type="password" name="password_confirm" class="form-control input-lg" placeholder="Confirm Password">
    </div>
    <div class="form-group">
        <button type='submit' class="btn btn-primary btn-lg btn-block">Sign In</button>
    </div>
</div>

Then I try to get all this information to my controller like this

public function insertInformation(){
                $this->load->helper('form');
                $this->load->library('form_validation');

                $this->form_validation->set_rules('name', 'Name', 'required');
                $this->form_validation->set_rules('email', 'Email', 'required');
                $this->form_validation->set_rules('phone', 'Phone', 'required');
                $this->form_validation->set_rules('password', 'Password', 'required|min_length[4]|max_length[32]');
                $this->form_validation->set_rules('password_confirm', 'Password Confirm', 'required|matches[password]');


                if ($this->form_validation->run() == FALSE){
                $this->load->view('header_view');
                $this->load->view('login_view');
                $this->load->view('footer_view');
                }else{

                    $data =  array(
                    'name' => $this->input->post('name'),
                    'email' => $this->input->post('email'),
                    'phone' => $this->input->post('phone'),
                    'password' => $this->input->post('password')

                );
                    $this->db->trans_begin();
                $this->load->model('main_page');
                $this->main_page->storeRegisterInfo($data);

                $message['account_created'] = 'Your account has been created';
                $this->load->view('admin_view', $message);
                }
             }

And here is the model ,

public function storeRegisterInfo($data){
            $insert = $this->db->insert('new_users',$data);
            return $insert;

        }

and my database looks like this enter image description here

I am pretty new to codeigniter so I am pretty sure there is alot of errors here, so please do help me out and please do explain me in steps for a better understanding. Thanks!

THis is the error enter image description here

  • 写回答

3条回答 默认 最新

  • duanbei1598 2016-01-31 23:08
    关注

    Remove this part, all should work then

    $this->db->trans_begin();
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退