dimanche 29 décembre 2019

Setting selected option in laravel from database

I have a problem here, I want to make an edit form, I want the province that appears in the edit form to be the province selected from the database, here my code

  <select name="provinsi" id="provinsi" class="form-control">
                <option value="">Pilih Provinsi</option>
                @foreach ($province as $prov)
                <option value=""></option>
                @endforeach
            </select>

here my controller code

public function ShowSantri(Request $request,$id)
    {

        $province = DB::table('provinces')->get();
        $profiles = Profile::find($request->id);

        return view('admin/modal/edit_santri',compact('profiles','province'));


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire