title: Sending data along with a redirect in CodeIgniter
body: <p>I have a simple C (of CRUD) function, and I'd like to send a message (error or success) along with my redirect from the "insert" function I have written up. Is there a way to adhere a POST field with a redirect?</p>
  
  <p>In pseudo code I have:</p>
  
  <pre><code>function view_all{
      //set up some initial variables
      $this-&gt;load-&gt;view(viewing_page, $data)
  }
  
  function insert{
      if ($this-&gt;db-&gt;insert(my_table, $_POST)){
          $message = "All's well";
      }
      else {
          $message = "whoops!";
      }
      redirect(view_all);
  }
  </code></pre>
  
  <p>So the viewing_page ideally would have something like </p>
  
  <pre><code>if (isset($message)){
      echo $message
  }
  </code></pre>
  
  <p>So on the first time through, I don't see any message, and when/if there's an insert, it pops up the same page with the message. Thanks!</p>