2

I have a multi-select box that's populated via JavaScript. After submitting a post request, it appears it only stores one value despite multiple selections. How can I retrieve all selections from a multi-select box in Laravel 5.5 after a post request?

[View]

<div class="form-group mx-sm-1"> <select id="customer" name="customer" type="form-control" class="form-control" multiple></select> </div> 

[Controller]

public function showResults(Request $request){ $field = Request::input('customer'); // dd("Reached POST with:", $field); $results = $this->performQuery($field); return view('filter', compact('results')); } 
0

1 Answer 1

5

Change name="customer" to name="customer[]"

This will pass values of <select> as array.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.