title: Codeigniter return variables from model to controller
body: <p>I am in the process of creating an activation email for my registration process. I need to pass the variables containing the activation code and email address from my model back to my controller where I will send the email.</p>
  
  <p>My registration form currently writes all signup data to the database and creates and activation code.</p>
  
  <p>How can you pass the variables 'activation_code' and 'email' from my model back to my controller for use in my email.</p>
  
  <p><strong>Model:</strong></p>
  
  <pre><code>... 
          $new_member_insert_data = array(
              'first_name' =&gt; $first_name,
              'last_name' =&gt; $last_name,
              'email_address' =&gt; $email,
              'password' =&gt; hashPassword($salt, $password, $hash),
              'activation_code' =&gt; activationCode($email, $hash.$salt),
              'hash' =&gt; $hash
          );
  
          $insert = $this-&gt;db-&gt;insert('members', $new_member_insert_data);
          return $insert;
      }
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>  $this-&gt;load-&gt;model('members_model');
                    if($this-&gt;members_model-&gt;create_member())//return variables here somehow
                      {
  
  //get activation code + email variables
  //send activation email
                          $this-&gt;session-&gt;set_flashdata('success', 'success');
                          redirect('home', 'location');
                      }
                      else
                      {
                          $viewdata['main_content'] = $category;
                          $this-&gt;load-&gt;view('includes/template', $viewdata);
                      }
  </code></pre>