Welcome Guest, Not a member yet? Register   Sign In
Input doesn't clear after each request?
#1

[eluser]parham90[/eluser]
Hi,

I have started creating that session-based wizard I talked about earlier. It has gone great up to this point, but there is a problem:

I want the user's session data to be incremented when $this->input->post('submit') is present, meaning that the submit button has been pressed. This doesn't work. What I did to find it out was this:

1. I loaded the first page.
2. I clicked on next.
3. The second page loaded. I went to the address bar and pressed enter, causing the address to be requested again.
4. The third step came up, even though I hadn't clicked on submit at all.

Here is the function:

Code:
function signup()
{
if ($this->session->userdata('step'))
$step = $this->session->userdata('step');
else
{
$step = 1;
$this->session->set_userdata('step', 1);
}
if ($this->input->post('submit'))
{
$step = $step + 1;
$this->session->set_userdata('step', $step + 1);
}
if ($step == 1)
$this->load->helper('file');
$this->template->write('title', ': Sign Up');
$this->template->write_view('content', 'users/signup/' . $step . '.php');
$this->template->render();
}

Any ideas?

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB