Reputation: 949
I have created a very simple form in laravel..
<?php
echo Form::selectRange('number', 2, 12);
echo Form::submit('Click Me!');
?>
However, at this time I am unclear of how to send the selected value of the DDL to the server to perform a task depending on which value is selected. For example, if 3 is selected it would send you to a specific view that would be different than if 4, 5, or 6 was selected. I checked out the documentation and couldn't find the direction I should go.
Upvotes: 0
Views: 673
Reputation: 1583
I believe that if you see the posted data, you'll see a field number
with the value selected in the input
.
In laravel you access to such variables as
$number = Input::get('number');
...
Hope it helps!
EDIT You also need to open and close the form:
{{ Form::open(array('url' => 'foo/bar')) }}
{{ Form::selectRange('number', 2, 12) }}
{{ Form::submit('Click Me!') }}
{{ Form::close() }}
EDIT2 Your routes.php should have something like this:
Route::post('foo/bar', function()
{
$number = Input::get('number');
.....
});
Upvotes: 1