1
votes

I have a Form that contains a Dropdown and a Submit button. Like so:

View path: webmasters/filters.blade.php

{{ Form::open() }}
  {{ Form::select('filt', $Dropdown, 2) }}
  {{ Form::Submit('Filter') }}
{{ Form::close() }}
{{ Form::close() }}

And a controller that populates the Dropdown with values queried from a DB. Like so:

Controller name: WebController.php

 class WebController extends BaseController {
    public function getFilters() {
    $filters = Dropdown::getFilters();
    return View::make('webmasters.filter',['Dropdown'=>$filters]);

}

Here is my route:

  Route::resource('topPage', 'WebController@getFilters');

getFilters is a model method that queries the DB for the values that come into the dropdown.

I would like to call a controller method upon submitting the form so that the said method queries another DB and returns a table (on the same page as the dropdown and submit button) based on the selected value of the dropdown.

I'm probably going about this the wrong way, so i'd really appreciate if anybody gave me a headsup. I would still prefer not to use Ajax on this because i dont know my way around it.

Thanks for your help.

1

1 Answers

2
votes

Since the default form created by Form::open() is using POST you can just add another method in your controller and are all set

public function postFilters() {
    $filt = Input::get('filt'); // getting the value of the select
}