Mhmd Backer Shehadi
Mhmd Backer Shehadi

Reputation: 589

how to set the selected option using illuminate Form

I am using the HtmlServiceProvider in laravel 5.1 to build my form , I want to set the selected option in select dropdown list tag when I get the data from my model class

My code so far:

{!! Form::model($advertisment,['url'=>'dashboard/edit/advertisment']) !!}
{!! Form::select('Gender', [""=>'Select Gender',"Male"=>'Male', "Female"=>'Female'],0, ['class' => 'form-control', 'id' => 'form_control_6' ,'required']) !!}
{!! Form::close() !!}

Upvotes: 0

Views: 140

Answers (2)

Zoe Blair
Zoe Blair

Reputation: 556

If you don't want to override the value from the model, pass in null

Upvotes: 0

Calin Blaga
Calin Blaga

Reputation: 1373

Set the 0 parameter to "Male" for example and you will figure it out

Upvotes: 2

Related Questions