wie neben bekommen und früheren Aufzeichnungen mit buttons
statt href
,Erhalten nächsten und vorherigen Aufzeichnungen in Laravel
zum Beispiel
<form method="post" action="/">
//Question and options will come here,
//when click on next button next question should appear and
// if I click on prev button it should goto prev question
<button type ="submit">Next Question
<button type ="submit">Previous Question
</form>
mein Controller
$questions = Question::find($qId);
$options = Question::find($qId)->options;
$previous = Question::where('id', '<', $questions->id)->max('id');
$next = Question::where('id', '>', $questions->id)->min('id');
return view('Pages/User/Questions/Question2')
->with('options',$options)
->with('questions',$questions)
->with('previous',Question::find($previous))
->with('next',Question::find($next));
Jetzt Wie neben schicken und prev id
auf der Schaltfläche senden.
Sie wollen mit Form aktuelle Frage id schicken? –
@Sagar Gautam ja –
Verwenden Sie einfach versteckte Eingabefeld was ist das Problem? –