suppose the html code snippet of a form is as simple as
<form action='test.php' method="post">
<select multiple="multiple" name="fruit">
<option value="apple">Apple</option>
<option value="orange">Orange</option>
<button type="submit"> Enter </button>
</select>
</form>
My Question is what’s the format of $_POST['fruit'] while executing the PHP scripts? It does not looks like an array. Since $_POST['fruit'][0] and $_POST['fruit'][1] does not work for access. I am wondering how to access the submitted array?
Use
var_dump($_POST['fruit']);to see your array structure and how you can access it.With such markup your fruits should be inside
$_POST['fruit']as intended.