CodeIgniter Forums
go back to a page with a form and bypass browser prompts - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: go back to a page with a form and bypass browser prompts (/thread-37326.html)



go back to a page with a form and bypass browser prompts - El Forum - 01-05-2011

[eluser]megamonk[/eluser]
i have a page with a form. its basically a search page where users can put keywords and shown results.

if they select an item on the results they are taken away from that search page.

my problem now is when they are in the results page and wanted to go back, either by pressing the back button on the browser or using JavaScript to the search page populated with the previous results, browsers will display a popup saying something like

"To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier."

i understand that this is a security feature on all browsers however this is not a secure page and its just a search page so i want to bypass this for user accessibility.

any ideas?


go back to a page with a form and bypass browser prompts - El Forum - 01-05-2011

[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