Show how you set it and how you are trying to get it. I see no session code in the posted
Feb 26, 2022
6
Level 1
How to get select menu session data in another page laravel 8
I can successfully get input session data on another page but I can't get select menu selected data in another page. please help me to get this.
This is my first form
<form action="{{route('admin.create.step.one.post')}}" method="POST">
@csrf
<label for="">Student Name</label>
<input type="text" name="student_name" value="{{{ $report->student_name ?? '' }}}">
<br>
<label for="">Email</label>
<input type="text" name="student_email" value="{{{ $report->student_email ?? '' }}}">
<br>
<label for="">Phone number</label>
<input type="text" name="student_phone" value="{{{ $report->student_phone ?? '' }}}">
<label for="">Group</label>
<select name="group" id="">
<option value="1" {{{ $report->group ?? '' }}}>Science</option>
<option value="2" {{{ $report->group ?? '' }}}>Arts</option>
</select>
<button type="submit">Preview</button>
</form>
I want to get session data in this page. I can;t get select menu session data.
<form action="">
@csrf
<table>
<td>{{$report->student_name}}</td>
<td>{{$report->student_email}}</td>
<td>{{$report->student_phone}}</td>
<td>{{$report->group}}</td>
</table>
</form>
Level 102
@akashbd great. Then you can extract it like $request->session()->pull('report'). But you shouldn't save a complete model in session. Save it to the database and add the id to session
Please or to participate in this conversation.