On the html page there is a multiple select list, for example
<form action="" method="post"> <select name="multi[]" multiple> <option value="Арбуз">Арбуз</option> <option value="Дыня">Дыня</option> <option value="Груша">Груша</option> </select> <input name="submit" type="submit" /> </form>
Here we took the data:
<?php if (isset($_POST['submit'])) { foreach ($_POST['multi'] as $selectedOption) echo $selectedOption.","; } ?>
For example, I chose all 3 (there may be as many as possible) options, how can I output all of them into separate variables? For example multi (1), multi (2), multi (3).
echo $_POST['multi'][0];
. As I expected, no separate variable is required for this. - Ipatiev