Jump to content

Multiple Select Boxes In Array


glenelkins

Recommended Posts

Hi

 

I am trying to have the following as an example:

 

<select name="test[]" multiple="multiple">options here</select>
<select name="test[]" multiple="multiple">options here</select>

 

Then using $_POST['test'] to grab the boxes in the array. I want to then loop over each box so for example:

 

$boxes = $_POST['test'];

foreach ( $boxes as $box ) 

    // now here i would of expected $box to be an array of the options,
}

 

but it's not working like this, all the options from all submitted select boxes come in one array so I cannot distinguish which select box in the array they relate to, is there a way to do this??

Link to comment
https://forums.phpfreaks.com/topic/211587-multiple-select-boxes-in-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.