I have this controller:
public function category($name)
{
$ch = DB::select('select * from quiz where category=?',['$name']);
return View('quiz.index',['quiz'=>$ch]);
}
returning to the view quiz.index
. this view has a form
<form method="POST" action="{{url('quiz/check/$quiz->category')}}"
{!! csrf_field() !!}
@foreach ($quiz as $q)
@if($q->level=='1')
{{ $q->qid }}.
{{ $q->question }}<br>
<input type='radio' name='mycheck[{{$q->qid}}]' value='1'>
{{ $q->opt1 }}<br>
<input type='radio' name='mycheck[{{$q->qid}}]' value='2'>
{{ $q->opt2 }}<br>
<input type='radio' name='mycheck[{{$q->qid}}]' value='3'>
{{ $q->opt3 }}<br>
<input type='radio' name='mycheck[{{$q->qid}}]' value='4'>
{{ $q->opt4 }}<br><br>
@endif
@endforeach
<button type="submit" class="btn btn-default">Get result</button>
</form>
what is wrong with the action in the form. it is not redirected to this route: in other words $quiz->category
in action might not be working.
Route::post('/quiz/check/{name}', 'playquiz@check');