Reputation: 115
I am trying to make a dynamic drop down menu. For example, if i have 3 rows, I want the drop down values are 1 , 2 , 3 and so on.
I have tried the code below, it works shows dynamic list but there is a '0' in the list I can't understand why
In my controller (this will get the S_Rank column which is exactly what i need to list in my drop down menu)
$ranks = array();
foreach($applications as $application) {
$ranks[] = $application->S_Rank;}
this is my view
{{Form::select('Abstract_Status_ID' ,[$ranks], $application->S_ID, ['class' => 'form-control', 'placeholder' =>$application->S_Rank] )}}
the result where it shows the weird '0'
Upvotes: 0
Views: 84
Reputation: 5358
You don't need to put the $ranks
array into another array.
{{ Form::select('Abstract_Status_ID', $ranks, $application->S_ID, ['class' => 'form-control', 'placeholder' => $application->S_Rank]) }}
Upvotes: 2