How can I redirect the user based on the selected radio button?
This is a multi-page form using sessions. The data gets stored with the last page of the form. I am following this tutorial: https://www.5balloons.info/multi-page-step-form-in-laravel-with-validation/
I want it to do this: If checked 'yes', go to the next page if checked 'no', skip the next page and go to the one after.
<form action="/form/update-step4" method="post">
@csrf
<div class="form-group">
<label class="radio-inline"><input type="radio" name="is_employed" value="1" {{{ (isset($user->is_employed) && $user->is_employed == '1') ? "checked" : "" }}}> Yes</label>
<label class="radio-inline"><input type="radio" name="is_employed" value="0" {{{ (isset($user->is_employed) && $user->is_employed == '0') ? "checked" : "" }}} checked> No</label>
</div>
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<button type="submit" class="btn btn-primary">Continue</button>
</form>
You can simply use some switch or if/else in controller actions to define redirect url based on selected checkboxes -- something like this: