通过页面刷新删除表单验证错误

I have a page that takes form input, it is written using HTML and PHP(codeignter framework), the issue I am facing is when there is a form validation error, the page refresh is not reloading the page like brand new, I mean its not clearing the input from fields and the error message still coming up on page refresh and even after I correct the input and hit submit, when I click browser back button the it is still loading the page with validation error.. Any idea why it happens or how to resolve it. I just need the page to reload when I refresh it.

Here is my view (view1.php)

<html>
<?php
    echo validation_errors();
    form_open('search_controller/search_fn');
    form_input('input1', set_value('input1'));  
    form_input('input2', set_value('input2'));
    form_input('input3', set_value('input3'));
    form_submit('submit', 'Submit');
?>
</html>
Controller Functions

function index() {
    $this->load->view('view1');
}

function search_fn {
    if($this->input->post('submit') {
        $this->form_validation->set_rules('input1', 'XXXX',      
                                'trim|some_validation');
        $this->form_validation->set_rules('input2', 'XXXX', 
                                'trim|some_validation');      
        $this->form_validation->set_rules('input3', 'XXXX',
                         'trim|some_validation');

        if($this->form_validation->run() == FALSE) {
            //when validation fails
            $this->load->view('view1');
        } else {
            //when all input is validated sucessfully
           do some processlisng,
           //load some other view
           $this->load->view('view2');
        }
    } else {
        //When page is refreshed, this is supposed to redirect
        redirect('search_controller/index');
    }       
}

when the input validation fails, the url comes back as www.something.com/search/search_fn and when I refresh, it basically loading the same page with same error message. I, somehow, need to reset the $this->input->post('search'), so that it will be true only when the search button is clicked.

Thanks.

Are you using CodeIgniter's redirect() function after processing form? you should always do that

I mean after you are done handling submitted data, instead of return TRUE or simply closing function, to a simple redirect('CONTROLLER_NAME'); even if you want them to be on the same page

As for the fields, i would suggest using autocomplete="off" in your inputs (if you are not using an <input type="text"> above an <input type="password"> because Chrome and next version of Firefox will ignore automplete="off" in that situation)