Level 8
Sorry guys, I figured it out. I had no idea that radio button can take value. So stupid...
I am stumped, I am using radio buttons, but radio buttons just returns 'radionbutton' => 'on'. Can anyone think of a quick easy solution to the problem at hand.
+------------+-----------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+-----------------+------+-----+---------+----------------+
| id | bigint unsigned | NO | PRI | NULL | auto_increment |
| name | varchar(255) | NO | | NULL | |
| category | varchar(255) | NO | | NULL | |
| image | varchar(255) | YES | | NULL | |
| created_at | timestamp | YES | | NULL | |
| updated_at | timestamp | YES | | NULL | |
+------------+-----------------+------+-----+---------+----------------+
+------------+-----------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+-----------------+------+-----+---------+----------------+
| id | bigint unsigned | NO | PRI | NULL | auto_increment |
| test_id | bigint unsigned | NO | | NULL | |
| name | varchar(255) | NO | | NULL | |
| image | varchar(255) | YES | | NULL | |
| created_at | timestamp | YES | | NULL | |
| updated_at | timestamp | YES | | NULL | |
+------------+-----------------+------+-----+---------+----------------+
+-------------+-----------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-----------------+------+-----+---------+----------------+
| id | bigint unsigned | NO | PRI | NULL | auto_increment |
| question_id | bigint unsigned | NO | | NULL | |
| correct | tinyint(1) | NO | | NULL | |
| name | varchar(255) | NO | | NULL | |
| image | varchar(255) | YES | | NULL | |
| created_at | timestamp | YES | | NULL | |
| updated_at | timestamp | YES | | NULL | |
+-------------+-----------------+------+-----+---------+----------------+
Test -< Question -<answers (very simple)
<div class="row my-3">
<div class="col-lg-12 col-md-12 col-sm-12">
@foreach ($test->questions as $index => $question)
<div class="h4">{{ $index + 1 }}. {{ $question->name }}</div>
<div class="row my-5">
@foreach ($question->answers as $index_c => $answer)
<div class="col-lg-4 col-md-6 col-sm-12">
<div class="card mx-4 my-1 h-100 d-inline-block" style="width: 18rem;">
@if (!empty($answer->image))
<img src="{{ $answer->image }}" class="card-img-top" alt="...">
@endif
<div class="card-body">
<label class="form-check-label" for="flexRadioDefault1">
<div class="p">{{ $answer->name }}</div>
</label>
<hr class="my-3">
<input class="mx-auto d-block mt-2" type="radio" name="answer{{ $index }}" id="selectedAnswer{{ $index_c }}" style="width: 20px; height: 20px;">
</div>
</div>
</div>
@endforeach
</div>
@endforeach
</div>
</div>
Sorry guys, I figured it out. I had no idea that radio button can take value. So stupid...
Please or to participate in this conversation.