mardi 13 février 2018

How can update multi select with multi diiferent option

In view code i have:

    <select name="eng_country['city']" class="form-control profile-engform readonly">
             @foreach($result['total_exp_country'] as $total_exp_country)
             <option value="" > </option>
             @endforeach
             </select>
          </div>
     <div class="col-md-6 col-xs-12">
  <label class="english">Years</label>
  <select name="eng_country['year']" class="form-control profile-engform readonly" id="eng_exp_year">
             @for($i=1;$i<=10;$i++)
             <option value=""  ></option>
            @endfor
             </select>

in controller : Code i have

foreach ($_POST['eng_country'] as $expcont) 
            {
             DB::table('tbl_worker_exp')->insert([
                ['worker_id' => $id, 'country_id' => $expcont['city'],'exp_year'=>$expcont['year']]
                ]);
         }

giving error :Illegal string offset 'city'

what i am doing wrong here i want to add the both of the fields anyone can please help..



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire