call a function on report_type change and store the value in session and then in another page get the value from the session. on form submit clear the session in the controller.
Feb 25, 2022
4
Level 1
How to get dropdown select value session in another page in Laravel 8
I wish I had a few options in one form. The user will select the report type from this form, and according to that selected value, I want to show the input field in a different form. I have been trying to do this for two days but I can't do it. It would be very helpful if someone could help
This is my form one code
<form action="{{url('prepare/create/report')}}" method="post">
<label for="">Report Type</label>
<select name="report_type">
@foreach($report_type as $data)
<option value="{{$data->id}}">{{$data->name}}</option>
@endforeach
</select>
</form>
I want to get the above form dropdown value session data in this form
<form action="{{url('start/create/report')}}" method="post">
@csrf
@if($report->report_type == '1001')
<label for="">Student Name</label>
<input type="text" name="name" value="">
@else
<label for="">Teacher Name</label>
<input type="text" name="name" value="">
@endif
</form>
I'm new to Laravel and don't really understand the season so I don't understand how my controller code will be.
This is my route code
Route::get('/prepare/create/report', [AdminController::class, 'PrepareCreateReport']);
Route::post('/prepare/create/report', [AdminController::class, 'StoreCreateReport']);
Route::get('/create/report/start', [AdminController::class, 'StartReportCreation'])->name('create.report');
Please or to participate in this conversation.