jeudi 2 avril 2020

Blade checked checkbox/radio where(['key' => 'head', 'position' => 1])?"checked" : "" doesn't work

I have a table with column key is for the place of the body and value is for the pain at that place 1=no, 2=sometimes, 3=yes. the value in this example is 2. So i tried this to check the correct checkbox

<div class="btn-group d-flex" data-toggle="buttons">
   <label class="btn btn-light">
      <input type="radio" name="answer[sleep][value]" value="1" > Nee
   </label>
   <label class="btn btn-light">
      <input type="radio" name="answer[sleep][value]" value="2" > Soms
   </label>
   <label class="btn btn-light">
   <input type="radio" name="answer[sleep][value]" value="3" > Ja
   </label>
</div>

They are all checked, but only value 2 is set where key='sleep', so why are they all checked? How do i fix this?




Aucun commentaire:

Enregistrer un commentaire