glenelkins Posted August 24, 2010 Share Posted August 24, 2010 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 More sharing options...
Adam Posted August 24, 2010 Share Posted August 24, 2010 Yeah just store each check box in a child array: <select name="test[set1][]" multiple="multiple">options here</select> <select name="test[set2][]" multiple="multiple">options here</select> Link to comment https://forums.phpfreaks.com/topic/211587-multiple-select-boxes-in-array/#findComment-1103024 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.