[eluser]Gukkie[/eluser]
Hi, i have a little problem here. Why is it when i click submit on a form and it there is an error, i get redirected to the url doing the function of the submit button instead of the view url?
eg.
Code:
function resend_activation($message = '')
{
$data['title'] = 'My Site | Resend Activation Email';
$data['description'] = '';
$data['keywords'] = '';
$data['robot'] = 'NOINDEX, NOFOLLOW';
$data['message'] = $message ;
$data['main_content'] = 'user/resend_activation';
$this->load->view('includes/template', $data);
}
Now, the function that controls the form submission:
Code:
function do_resend()
{
if($this->input->post('submit'))
{
$this->form_validation->set_rules('email', '<b>Email Address</b>', 'trim|required|valid_email|callback_validate_email');
$this->form_validation->set_error_delimiters('<div class="input_error">', '</div>');
if($this->form_validation->run() == FALSE)
{
$this->resend_activation('Please correct the errors in the form.');
}
else
{
$email = $this->input->post('email');
$this->resend_activation('Activation email successfully sent. Please check your email.');
}
}
}
View:
Code:
<?=(isset($message) && $message) ? $this->load->view('includes/message') : '';?>
<?=form_open('user/do_resend');?>
<dl>
<?=form_error('email');?>
<dt><?=form_label('Email Address :');?></dt>
<dd><?=form_input('email', $this->input->post('email'), 'size=25, maxlength=64');?></dd>
<dt></dt>
<dd><?=form_submit('submit', 'Submit');?></dd>
</dl>
<?=form_close();?>
Now, the url for the resend email page would be "http://www.domain.com/user/resend_activation",
but when i click submit, why does the url change to "http://www.domain.com/user/do_resend" ?
Any way i can fix this instead of using redirect(), as redirect does not pass my variable message into the view?