title: How to show success message using codeigniter?
body: <p>i have a from layout, when i press submit button the data from this page save into database. I can print my form validation errors in the same page but i cannot print my success message into this page, i can print success message into another page, how can i show the message into same page plz help.</p>
  
  <p>Here is controller:</p>
  
  <pre><code>    function addRoom(){
          $data['title'] = 'Add Room';
          $data['main_content'] = 'config/addRoom';
          $data['roomlists'] = $this-&gt;config_mdl-&gt;get_room_info();
          $this-&gt;load-&gt;view('_base/layout', $data);
      }
  
      function roomAdd(){
          $this-&gt;form_validation-&gt;set_rules('roomType', 'Room Type', 'trim|required|xss_clean');
          $this-&gt;form_validation-&gt;set_rules('roomName', 'Room Name', 'trim|required|xss_clean');
          $this-&gt;form_validation-&gt;set_rules('roomDetails', 'Room Details', 'trim|required|xss_clean');
          $this-&gt;form_validation-&gt;set_error_delimiters('&lt;div class="alert alert-danger" role="alert"&gt;', '&lt;/div&gt;');
  
          if ($this-&gt;form_validation-&gt;run() == FALSE) {
  
              $this-&gt;addRoom();
  
          } else {
              $roomdata = array('room_type' =&gt; $this-&gt;input-&gt;post('roomType'),
                               'room_name' =&gt; $this-&gt;input-&gt;post('roomName'),
                               'room_details' =&gt; $this-&gt;input-&gt;post('roomDetails'));
              $this-&gt;config_mdl-&gt;roomAdd($roomdata);
  
          }           
      }
  </code></pre>
  
  <p>Here is my model:</p>
  
  <pre><code>    function roomAdd($roomdata)
      {
          return $this-&gt;db-&gt;insert('tbl_room_info', $roomdata);
      }
  </code></pre>
  
  <p>Here is My view:</p>
  
  <pre><code>    &lt;div class="panel-body"&gt;
      &lt;?php echo validation_errors(); ?&gt;
      &lt;?php $attributes = array('class' =&gt; 'form-horizontal', 'role' =&gt; 'form');
                          echo form_open_multipart('config/roomAdd', $attributes);
                      ?&gt;
      &lt;div class="form-group"&gt;
          &lt;label for="roomType" class="col-sm-2 control-label"&gt;Room type&lt;/label&gt;
          &lt;div class="col-sm-2"&gt;
          &lt;select name="roomType" class="form-control"&gt;
          &lt;option&gt;Select&lt;/option&gt;
          &lt;option value="1"&gt;1&lt;/option&gt;
          &lt;option value="2"&gt;2&lt;/option&gt;
          &lt;/select&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
          &lt;label for="roomName" class="col-sm-2 control-label"&gt;Room Name&lt;/label&gt;
          &lt;div class="col-sm-6"&gt;
          &lt;input type="text" class="form-control" name="roomName" placeholder="Type Room Name" /&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
          &lt;label for="roomDetails" class="col-sm-2 control-label"&gt;Room Details&lt;/label&gt;
          &lt;div class="col-sm-6"&gt;
          &lt;textarea class="form-control" name="roomDetails" rows="3"&gt;&lt;/textarea&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
          &lt;div class="col-sm-offset-2 col-sm-6"&gt;
          &lt;button type="submit" class="btn btn-primary"&gt;Submit&lt;/button&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;?php echo form_close(); ?&gt;
      &lt;/div&gt;
  </code></pre>