After a few testing here and there, I have finally found a way where I can get the registered username. But I still can't make it to display on the page. I am stuck at getting the value from Model to Controller.
Below are my codes:
Model (user_model):
public function create_user( $role, $insert_array = array() )
{
if( ! empty( $insert_array ) OR $this->validate() === TRUE )
{
...
// Verify transaction was successful
if( $this->db->trans_status() !== FALSE )
{
// Load var to confirm user inserted into database
$this->load->vars( array( 'user_created' => 1 ) );
$reg_username = $user_data['user_name'];
}
return TRUE;
}
return FALSE;
}
View:
if( isset( $validation_passed ) && $reg_mode == 1 )
{
echo '
<div class="feedback confirmation">
<p>
Thank you for registering. Your new username is : You may now ' . secure_anchor('user', 'login') . '.
</p>
</div>
';
}
Controller:
$this->load->model('user_model');
$this->user_model->create_user( 'customer', array() );
What and how should I do it?
Appreciate if you guys can help me out on this. Thanks in advance.