-1

Hy all, im working with Forms in laravel and i have problem with dropdown(select).

In my controller i have this:

public function get_edit($id) {
    $select = array('A' => 'something1', 'B' => 'something2', 'C' => 'something3');
    $this->data['id'] = $id;
    $this->data['options'] = $select;

    return View::make('blabla::folder.edit', $this->data);
}

And in that view(among others forms input) i have this line:

{{ Form::select('something', $options) }}

Problem is that when i select some option from dropdown in the view, for example "something1" i expected to get back "something1" but i get "A".

For example i need to populate some table with value from dropdown, which is demonstrated on the below picture, in cell where i'm expecting to get "something1" i get "A".

Fetching data with:

    $input = Input::get('something');

Picture: http://pokit.org/get/?f183e32124e80b1f37804bbb576ccc0a.jpg

Any suggestion(beside inverting key/value)? Thanks.

4

1 回答 1

1

Change your array from

array('A' => 'something1', 'B' => 'something2', 'C' => 'something3');

to

array('something1' => 'something1', 'something2' => 'something2', 'something3' => 'something3');

Because value is passed when you select an item from the select and in your select you have values A, B and C.

于 2013-05-27T20:06:31.927 回答