I have an edit account page, and I want to put the value in the database as selected :
@foreach($all_orga as $val)
@if($val->id_organisme==13)
<OPTION selected value=""></OPTION>
@else
<OPTION value=""></OPTION>
@endif
@endforeach
This works fine as it displays the list but nothing is "selected", so I edited it using $compte->id_organisme, which is equal 3 in my test:
@foreach($all_orga as $val)
@if($val->id_organisme == $compte->id_organisme)
<OPTION selected value=""></OPTION>
@else
<OPTION value=""></OPTION>
@endif
@endforeach
It still displays the list, but again, nothing "selected".
Informations :
dd($all_orga)
EQUALS
array:12 [▼
0 => {#566 ▼
+"id_organisme": 2
+"nom": "Orga 1"
}
1 => {#515 ▶}
2 => {#565 ▶}
3 => {#564 ▶}
4 => {#563 ▶}
5 => {#562 ▶}
6 => {#561 ▶}
7 => {#560 ▶}
8 => {#559 ▶}
9 => {#558 ▶}
10 => {#557 ▶}
11 => {#556 ▶}
]
dd($compte->id_organisme)
EQUALS
3
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire