I've got next situation:
I have multiple select boxes (that can select multiple choices) and i need that in php to be processed.
A code is next:
<select name="selectusers[]" multiple> <option value="1">John</option> <option value="2">Smith</option> </select> <select name="selectusers[]" multiple> <option value="1">John</option> <option value="2">Smith</option> </select> <input type="submit" value="Send" />
So now, in PHP I do the general foreach
<?php
foreach($select_users as $users){
...
}
?>
But each time I do foreach loop, and i print_r($select_users); inside of foreach, it gives me same result like:
Array([0]=>Array([0]=>30)[1]=>Array([0]=>33))
Array([0]=>Array([0]=>30)[1]=>Array([0]=>33))
What should I do?
Thank you.
You need to change the name of your select:
<select name="selectusers[]" multiple> <option value="1">John</option> <option value="2">Smith</option> </select> <select name="selectusers2[]" multiple> <option value="1">John</option> <option value="2">Smith</option> </select> <input type="submit" value="Send" />
Try this.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.