您好,我在codeigniter中更新数据时遇到错误

时间:2017-08-26 12:01:43

标签: php codeigniter

我有一个错误。

  

遇到PHP错误         严重性:通知
        消息:未定义的变量:文章
        文件名:views / update_data.php
        行号:126

这是我的控制器代码。

 public function update_day_data($article_id){

            if ($this->form_validation->run()){
    $data=array();

    $this->data['no_1'] = $this->input->post('no_1');
    $this->data['no_2'] = $this->input->post('no_2');
    $this->data['no_3'] = $this->input->post('no_3');
    $this->data['no_4'] = $this->input->post('no_4');
    $this->data['no_5'] = $this->input->post('no_5');
    $this->data['no_5'] = $this->input->post('no_6');


            $this->load->model('user_model');



        if ($this->user_model->update_kohinoor_day_data($article_id, $data)){

            $this->session->set_flashdata('feedback_class1',"Record Update Successfully.");
            $this->session->set_flashdata('feedback1','alert-success');


        }else {

            $this->session->set_flashdata('feedback_class1',"Problem adding to database.");
        $this->session->set_flashdata('feedback1','alert-danger');

        }
        return redirect('Kohinoor_panna/get_kohinoor_panna');


} else {

    $this->load->view('update_data');

}

}

这是我的标准代码。

 public function update_kohinoor_day_data($article_id, Array $data){

return $this->db
 ->where('id',$article_id)
 ->update('kohinoor_day', $data);

 }

这是我的观看代码。

<?php echo form_open("kohinoor_panna/update_day_data/{$article->id}",['class'=>'form-horizontal']); ?>

                      <fieldset>
                        <div class="control-group">
                          <label class="control-label" for="typeahead">Enter No </label>
                          <div class="controls">
                          <?php
                                            if($article->color_1==0){

                                    ?>
                                     <?php echo form_input(['name'=>'no_1','type'=>'text','id'=>'typeahead','maxlength'=>'2','style'=>'color:black;','placeholder'=>'Enter No','value'=>set_value('no', $article->no_1)]); ?>
                  <?php echo form_error('no'); ?>
                                    <?php
                                    }elseif($article->color_1==1){
                                        ?>
                                        <?php echo form_input(['name'=>'no_1','type'=>'text','id'=>'typeahead','maxlength'=>'2','style'=>'color:red;','placeholder'=>'Enter No','value'=>set_value('no', $article->no_1)]); ?>
                  <?php echo form_error('no'); ?>

                                    <?php

                                    }
                                    ?>

                          </div>
                        </div>
                        <div class="control-group">
                          <label class="control-label" for="typeahead">Enter No </label>
                          <div class="controls">
                          <?php
                                            if($article->color_2==0){

                                    ?>
                                     <?php echo form_input(['name'=>'no_2','type'=>'text','id'=>'typeahead','maxlength'=>'2','style'=>'color:black;','placeholder'=>'Enter No','value'=>set_value('no', $article->no_2)]); ?>
                  <?php echo form_error('no'); ?>
                                    <?php
                                    }elseif($article->color_2==1){
                                        ?>
                                        <?php echo form_input(['name'=>'no_2','type'=>'text','id'=>'typeahead','maxlength'=>'2','style'=>'color:red;','placeholder'=>'Enter No','value'=>set_value('no', $article->no_2)]); ?>
                  <?php echo form_error('no'); ?>

                                    <?php

                                    }
                                    ?>



                          </div>
                        </div>
                        <div class="control-group">
                          <label class="control-label" for="typeahead">Enter No </label>
                          <div class="controls">
                         <?php
                                            if($article->color_3==0){

                                    ?>
                                     <?php echo form_input(['name'=>'no_3','type'=>'text','id'=>'typeahead','maxlength'=>'2','style'=>'color:black;','placeholder'=>'Enter No','value'=>set_value('no', $article->no_3)]); ?>
                  <?php echo form_error('no'); ?>
                                    <?php
                                    }elseif($article->color_3==1){
                                        ?>
                                        <?php echo form_input(['name'=>'no_3','type'=>'text','id'=>'typeahead','maxlength'=>'2','style'=>'color:red;','placeholder'=>'Enter No','value'=>set_value('no', $article->no_3)]); ?>
                  <?php echo form_error('no'); ?>

                                    <?php

                                    }
                                    ?>

                          </div>
                        </div>
                        <div class="control-group">
                          <label class="control-label" for="typeahead">Enter No </label>
                          <div class="controls">
                          <?php
                                            if($article->color_4==0){

                                    ?>
                                     <?php echo form_input(['name'=>'no_4','type'=>'text','id'=>'typeahead','maxlength'=>'2','style'=>'color:black;','placeholder'=>'Enter No','value'=>set_value('no', $article->no_4)]); ?>
                  <?php echo form_error('no'); ?>
                                    <?php
                                    }elseif($article->color_4==1){
                                        ?>
                                        <?php echo form_input(['name'=>'no_4','type'=>'text','id'=>'typeahead','maxlength'=>'2','style'=>'color:red;','placeholder'=>'Enter No','value'=>set_value('no', $article->no_4)]); ?>
                  <?php echo form_error('no'); ?>

                                    <?php

                                    }
                                    ?>


                          </div>
                        </div>
                        <div class="control-group">
                          <label class="control-label" for="typeahead">Enter No </label>
                          <div class="controls">
                          <?php
                                            if($article->color_5==0){

                                    ?>
                                     <?php echo form_input(['name'=>'no_5','type'=>'text','id'=>'typeahead','maxlength'=>'2','style'=>'color:black;','placeholder'=>'Enter No','value'=>set_value('no', $article->no_5)]); ?>
                  <?php echo form_error('no'); ?>
                                    <?php
                                    }elseif($article->color_5==1){
                                        ?>
                                        <?php echo form_input(['name'=>'no_5','type'=>'text','id'=>'typeahead','maxlength'=>'2','style'=>'color:red;','placeholder'=>'Enter No','value'=>set_value('no', $article->no_5)]); ?>
                  <?php echo form_error('no'); ?>

                                    <?php

                                    }
                                    ?>


                          </div>
                        </div>
                        <div class="control-group">
                          <label class="control-label" for="typeahead">Enter No </label>
                          <div class="controls">
                         <?php
                                            if($article->color_6==0){

                                    ?>
                                     <?php echo form_input(['name'=>'no_6','type'=>'text','id'=>'typeahead','maxlength'=>'2','style'=>'color:black;','placeholder'=>'Enter No','value'=>set_value('no', $article->no_6)]); ?>
                  <?php echo form_error('no'); ?>
                                    <?php
                                    }elseif($article->color_6==1){
                                        ?>
                                        <?php echo form_input(['name'=>'no_6','type'=>'text','id'=>'typeahead','maxlength'=>'2','style'=>'color:red;','placeholder'=>'Enter No','value'=>set_value('no', $article->no_6)]); ?>
                  <?php echo form_error('no'); ?>

                                    <?php

                                    }
                                    ?>


                          </div>
                        </div>





                        <div class="form-actions">
                        <?php echo form_submit(['name'=>'submit','value'=>'Submit' ,'class'=>'btn btn-primary'] ),
                              form_reset(['name'=>'reset','value'=>'Reset', 'class'=>'btn btn-primary']);
                        ?>

                        </div>

                      </fieldset>


                     <?php echo form_close(); ?>

当我点击提交按钮时,它不会在Kohinoor_panna / get_kohinoor_panna上重定向。它将在该页面上返回。我厌倦了这个错误我需要知道的是为什么我会收到这些错误?抱歉我的英语不好。谢谢你。

0 个答案:

没有答案