How can I show success message (not alert box) in home page after successful signup

codeigniter

Solution

set your success message in session flash message and then show in home page as you want.

$this->session->set_flashdata('success_msg', 'success');

to get success message

echo $this->session->flashdata('success_msg');

Set flash message in your controller, then redirect to home page after successfull registration.

Problem

How can I show a success message (not alert box) in home page after a successful signup? This is my controller function. ``` public function reg() { $data['baseurl'] = base_url(); $baseurl = base_url(); $this->load->model('Regdatabase'); $this->form_validation->set_rules('firstname', 'First Name', 'required'); $this->form_validation->set_rules('lastname', 'Last Name', 'required'); $this->form_validation->set_rules('email', 'Email', 'required|valid_email'); $this->form_validation->set_rules('password', 'Password', 'required|matches[cpassword]|md5'); $userdata['id'] = Null; $userdata['firstname'] = $this->input->post('firstname'); $userdata['lastname'] = $this->input->post('lastname'); $userdata['email'] = $this->input->post('email'); $userdata['password'] = $this->input->post('password'); $userdata['status'] = "1"; $this->Regdatabase->DataInsert($userdata); // INSERT DATA INTO TABLE redirect($baseurl.'register'); } ```

Original source