I have this code
@foreach($questions as $question_name => $question_details)
<h5>{{ $question_name }}</h5>
@foreach($question_details as $question_id => $question_description)
<p class="ms-3">{{ $question_description }}</p>
<input type="hidden" name="question_id[]" value="{{ $question_id }}"/>
<textarea name="answers[]" class="form-control ms-3" cols="30" rows="2" placeholder="Your answer here.."></textarea>
@endforeach
@endforeach
And when I submit a form with some empty values, the answers that I got also get deleted if some error occurs I tried this to get back my old inputs but it didn't bring me anything
I tried
<textarea name="answers[]" class="form-control ms-3" cols="30" rows="2" placeholder="Your answer here..">{{ old('answers') }}</textarea>
<textarea name="answers[]" class="form-control ms-3" cols="30" rows="2" placeholder="Your answer here..">{{ old('answers[]') }}</textarea>
<textarea name="answers[]" class="form-control ms-3" cols="30" rows="2" placeholder="Your answer here..">{{ old('answers.0') }}</textarea>
But nothing really succeed to bring me back the old values that I typed can someone help me with that?
dd(session()->getOldInput())reutrns, add this while submitting.old('answers[0]')orold('answers.0'). See stackoverflow.com/questions/42050732/old-input-for-array