Padraig
5 months ago
1103
6
Requests

Pass input from dropdown selection to confirmation page

Posted 5 months ago by Padraig

Any help with the following would be appreciated.

I have a seat-plan.blade.php file with a form (excerpt below)

@csrf
                <div required class="form-group">
                    <label><strong>Choose Boarding Point <span class="text-danger">*</span></strong></label>
                    <select name="boarding" id="stoppage" class="form-control form-control-lg boarding_point">
                        <option value="">Boarding Point</option>
                        @foreach($stoppage as $board)
                            <option value="{{$board}}">{{$board}}</option>
                        @endforeach
                    </select>
    
                </div>

Further down the page I have...

``<input type="hidden" name="trip_route_id" value="{{$tripAssign->trip_route_id}}"> <input type="hidden" name="fleet_registration_id" value="{{$tripAssign->fleet_registration_id}}"> <input type="hidden" name="trip_id_no" value="{{$tripAssign->id}}"> <input type="hidden" name="id_no" value="{{$tripAssign->id_no}}"> <input type="hidden" name="fleet_type_id" value="{{$tripAssign->fleetRegistration->fleet_type_id}}"> <input type="hidden" name="total_seat"> <input type="hidden" name="seat_number"> <input type="hidden" name="boarding" value="{{$board}}"> <input type="hidden" name="price" value="{{$ticketPrice}}"> <input type="hidden" name="total_fare"> <input type="hidden" name="booking_date" value="{{$tripAssign->start_date}}"

On submission of the form the following confirmation page shows the input details correctly except for the borading details.

The problem is with ​``<input type="hidden" name="boarding" value="{{$board}}"

It just takes the last option from the dropdown menu regardless of how many options there are. How can I change it to pass the user selected option?

Please sign in or create an account to participate in this conversation.