Cara supaya value radio button nya adalah id database, Laravel

Mohon bantuan

                        @foreach($rekomenkamar as $rk)
                        {{csrf_field()}}
                        <label class="btn card-rekomen" id="card" value="{{$rk->id_kamar}}">
                            <input type="radio" name="id_kamar" >
                            <div class="desc">
                                <h3>{{$rk->nama_ktgKamar}}</h3>
                                <h5 style="font-family:'Poppins', sans-serif; font-weight:400">best available {{$rk->keterangan}} </h5>
                                <p><i class="fi-rr-user"></i>&nbsp {{$rk->max_org}}</p>
                                <p><i class="fi-rr-protractor"></i>&nbsp {{$rk->luas_kamar}}<sup>2</sup></p>
                                <p><svg xmlns="http://www.w3.org/2000/svg" fill="white" width="20" height="20" viewBox="0 0 512 512"><path d="M496,344h-8V280a32.042,32.042,0,0,0-32-32V112a32.042,32.042,0,0,0-32-32H88a32.042,32.042,0,0,0-32,32V248a32.042,32.042,0,0,0-32,32v64H16a8,8,0,0,0-8,8v32a8,8,0,0,0,8,8h8v32a8,8,0,0,0,8,8H56a7.99,7.99,0,0,0,7.84-6.43L70.56,392H441.44l6.72,33.57A7.99,7.99,0,0,0,456,432h24a8,8,0,0,0,8-8V392h8a8,8,0,0,0,8-8V352A8,8,0,0,0,496,344ZM72,112A16.021,16.021,0,0,1,88,96H424a16.021,16.021,0,0,1,16,16V248H424V216a32.042,32.042,0,0,0-32-32H296a32.042,32.042,0,0,0-32,32v32H248V216a32.042,32.042,0,0,0-32-32H120a32.042,32.042,0,0,0-32,32v32H72ZM408,216v32H280V216a16.021,16.021,0,0,1,16-16h96A16.021,16.021,0,0,1,408,216Zm-176,0v32H104V216a16.021,16.021,0,0,1,16-16h96A16.021,16.021,0,0,1,232,216ZM40,280a16.021,16.021,0,0,1,16-16H456a16.021,16.021,0,0,1,16,16v64H40Zm9.44,136H40V392H54.24ZM472,416h-9.44l-4.8-24H472Zm16-40H24V360H488Z"/></svg>&nbsp {{$rk->type_kasur}}</p>
                                <hr>
                                <p class="harga">Rp. {{$rk->harga}}</p>
                            </div>
                        </label>
                        @endforeach

Tapi pas diinspect valuenya kosong

Capture.PNG

avatar monicafebyana
@monicafebyana

1 Kontribusi 0 Poin

Diperbarui 3 tahun yang lalu

1 Jawaban:

<div>Harusnya attribute value itu taruh di tag input, bukan di tag label, contohnya gini :<br>&nbsp;</div><pre> @foreach($rekomenkamar as $rk) {{csrf_field()}} &lt;label class="btn card-rekomen" id="card"&gt; &lt;input type="radio" name="id_kamar" <strong>value="{{$rk-&gt;id_kamar}}"</strong>&gt; .... &lt;/label&gt; @endforeach</pre><div><br>Untuk melihat ada attribute apa saja pada tag label dan tag input, silahkan cek disini :<br>- <a href="https://www.w3schools.com/tags/tag_input.asp">https://www.w3schools.com/tags/tag_input.asp</a><br>- <a href="https://www.w3schools.com/tags/tag_label.asp">https://www.w3schools.com/tags/tag_label.asp</a><br><br>Semoga terbantu.<br><br></div><div>&nbsp;</div>

avatar ahanafi
@ahanafi

815 Kontribusi 554 Poin

Dipost 3 tahun yang lalu

Login untuk ikut Jawaban