Welcome Guest, Not a member yet? Register   Sign In
go back to a page with a form and bypass browser prompts
#2

[eluser]Nick_MyShuitings[/eluser]
My personal solution goes like this:

1) all forms submit to the submit() method of the controller. They are switched on the form id or submit id and processed
2) then they redirect to the proper method to handle the display of the new page.

Here's an example:

Code:
class units extends MY_Controller {
  function __construct() {
    parent::__construct();
  }

  function index() {
    redirect('units/search/0');
  }

  function submit() {
    $this->load->library('input');
    if($this->input->post('search_filter')) {
//bunch of processing in this case just cleaning the vars and sending them to the redirect below...
      redirect('units/search/'.$site.'/'.$size.'/'.$areacode.'/'.$distance.'/'.$pricesort.'/'.$sizesort.'/'.$climate.'/'.$inside.'/'.$power.'/'.$alarm);
    }
...

The form's action is sent to the units/submit path, and it handles it from there.

With this setup I avoid that annoying browser message, and in this specific case provide a unique url for each possible search combination... something my SEO geek said is good Smile


Messages In This Thread
go back to a page with a form and bypass browser prompts - by El Forum - 01-05-2011, 09:43 PM



Theme © iAndrew 2016 - Forum software by © MyBB