0

I have an error.

A PHP Error was encountered
Severity: Notice
Message: Undefined variable: article
Filename: views/update_data.php
Line Number: 126

This is my controller code.

 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');

}

}

This is my Model Code.

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

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

 }

This is my view code.

<?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(); ?>

When i click submit button it will not redirect on Kohinoor_panna/get_kohinoor_panna. It will return on that page. Iam tired of getting this error What I need to know is why do I get these errors? sorry for my bad English.Thank You.

Qirel
  • 25,449
  • 7
  • 45
  • 62
Mrigank Gaur
  • 1
  • 2
  • 6

0 Answers0