Advertisement — Top

Responsive Advertisement

CodeIgniter Form Validation – Setting Rules, Setting Error Messages and Repopulating Form

ViewFile.
<?php if($this->session->flashdata("message_name")): ?>
<div class="alert alert-success" name="message_name">
              <?php echo $this->session->flashdata("message_name"); ?>
</div>              
    <?php endif; ?>


Controller:

$data ['rest'] = $this->admin_model->update_account_setting($id,$data);

if(validation_errors() != false) 
{
    $this->session->set_flashdata('error_message','Data Unsuccessful Updated.');
redirect('admin/account_setting');
      }
      else
      {
      $this->session->set_flashdata('message_name','Data Updated.');
redirect('admin/account_setting');

      }

Post a Comment

0 Comments