i have encountered not working redirect in one of my method. but the rest redirect is working. by the way in my localhost that redirect is working but when i put it in my site to test it. it did not pass to that redirect instead it stayed in signup_validation and still received email verification in my email.
public function signup_validation() {
$account = array(
'email' => strip_tags($this->input->post('email')),
'password' => sha1($this->input->post('password')),
'firstname' => strip_tags($this->input->post('firstname')),
'lastname' => strip_tags($this->input->post('lastname')),
'contact_number' => $this->input->post('contact_number'),
'home_address' => strip_tags($this->input->post('home_address')),
'gender' => $this->input->post('gender'),
'g-recaptcha-response' => $this->input->post('g-recaptcha-response')
);
$this->form_validation->set_rules('email', 'Email', 'required|valid_email|is_unique[account.email]');
$this->form_validation->set_rules('password', 'Password', 'required|min_length[6]|max_length[32]');
$this->form_validation->set_rules('cpassword', 'Confirm Password', 'required|matches[password]');
$this->form_validation->set_rules('firstname', 'First name', 'required|callback_alpha_dash_space');
$this->form_validation->set_rules('lastname', 'Last name', 'required|callback_alpha_dash_space');
$this->form_validation->set_rules('contact_number', 'Contact Number', 'required|callback_number|min_length[7]|max_length[11]');
$this->form_validation->set_rules('gender', 'Gender', 'required');
$this->form_validation->set_rules('home_address', 'required|callback_address');
$this->form_validation->set_rules('tac', 'Terms and Condition', 'required');
$this->form_validation->set_rules('g-recaptcha-response', 'Recaptcha', 'required');
$this->form_validation->set_message('number', 'The %s must be a number');
$this->form_validation->set_message('address','The %s must contain only letters, period, comma, spaces and dash.');
$this->form_validation->set_message('is_unique', 'Email address is already used.');
$this->form_validation->set_message('alpha_dash_space','The %s must contain only letters, period, spaces, and dash.');
if ($this->form_validation->run() == FALSE) {
$this->register();
} else {
$recaptcha = $this->input->post('g-recaptcha-response');
if (!empty($recaptcha)) {
$response = $this->recaptcha->verifyResponse($recaptcha);
if (isset($response['success']) and $response['success'] === true) {
$this->MainModel->add_account();
redirect('main/email_sent', 'refresh');
}
}
}
}
Remove the second parameter of redirect()
, when set the second parameter to 'refresh'
this method will just refresh current page.
redirect('main/email_sent');
remove second parameter ('refresh') from
redirect('main/email_sent', 'refresh');
Just Excited to know if it works.