Skip to content
Advertisement

Catch array of HTML multiple select with PHP

I have two multiple selects declared as:

JavaScript

I want to catch the values in PHP, like this

JavaScript

But the values come like this (with print_r on the $_POST):

JavaScript

instead of:

JavaScript

How can this be achieved? Can anyone help? Thanks in advance.

Advertisement

Answer

Try changing the names of the fields on the form to the indices at which you want the desired result:

JavaScript

Then $_POST output is:

JavaScript

Or even like this:

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement