1

I am using Image Picker to select multiple options.

Image Picker is a simple jQuery plugin that transforms a select element into a more user-friendly graphical interface.

I want to retrieve the selected options and print them after submitting them via a form.


HTML CODE(again I am using Image Picker)

<select multiple="multiple" name="visualstyle[]" class="image-picker" id="visualstyle">
                                <option data-img-src="https://placeimg.com/200/200/any" value="1">1</option>
                                <option data-img-src="https://placeimg.com/200/200/nature" value="2">2</option>
                                <option data-img-src="https://placeimg.com/200/200/people" value="3">3</option>
                                <option data-img-src="https://placeimg.com/200/200/any" value="4">4</option>
</select>

This is inside a form <form action="form.php" method="post">

PHP (form.php)

<?php
$values = $_POST['visualstyle'];

foreach ($values as $a){
    echo $a;
}
?>

I followed this question but it doesn't work. Only a blank page appears when I submit the form after selecting multiple options.

ray an
  • 1,132
  • 3
  • 17
  • 42

0 Answers0