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.
My registration form currently writes all signup data to the database and creates and activation code.
How can you pass the variables 'activation_code' and 'email' from my model back to my controller for use in my email.
Model:
...
$new_member_insert_data = array(
'first_name' => $first_name,
'last_name' => $last_name,
'email_address' => $email,
'password' => hashPassword($salt, $password, $hash),
'activation_code' => activationCode($email, $hash.$salt),
'hash' => $hash
);
$insert = $this->db->insert('members', $new_member_insert_data);
return $insert;
}
Controller
$this->load->model('members_model');
if($this->members_model->create_member())//return variables here somehow
{
//get activation code + email variables
//send activation email
$this->session->set_flashdata('success', 'success');
redirect('home', 'location');
}
else
{
$viewdata['main_content'] = $category;
$this->load->view('includes/template', $viewdata);
}