Please am trying to create an online examination platform in PHP/Laravel. I have the questions and answers stored in the database. i have been able to retrieve all Question and answer using foreach
. How can I display one question/answer at a time for the student to solve. Something like a Next button after the first Question. The is my controller code:
public function showQuestions($course_code, $course_semester)
{
$course = Course::find($course_code);
$courseQuestion = DB::table('courses')
->select('*')
->join('questions', 'courses.course_code', 'questions.subject_code')
->where('course_code','=', $course_code)
->where('course_semester','=',$course_semester)
->get();
return view('all-question-page',[
'display' => $courseQuestion,
'course' => $course
]);
}
in my blade file, I used foreach which basically displays all questions and answers and its even disallowing me to select answers for different question because it has a same ```field type name````. I want to display the Question One by One or any best possible way i can do this. I need assistance