vendredi 8 juin 2018

How to show old data of checkbox in Laravel foreach?

i try to submit form in foreach blade laravel but why it is not checked after submit?

<form method="get" class="form-inline float-left">
   <div class="form-group mb-2">
      <input type="text" id="keyword" name="keyword" class="form-control" placeholder="keyword here" value="">
   </div>
   <ul class="nav nav-pills" id="nav">
      @foreach($menu as $d)
      <li role="presentation">
         <a class="text-capitalize" >
         <input type="checkbox" name="cx[]" value="" {!! (is_array(old('cx[]')) and in_array($d->custom_search_id, old('cx[]'))) ? ' checked' : '' !!} > 
         {!! $d->name !!}
         </a>
      </li>
      @endforeach
   </ul>
   <div class="form-group mb-2">
      <input type="submit" class="btn btn-primary" value="GO!">
   </div>
</form>


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire