Reputation: 179
I have a simple form with multi select like this
<select multiple="multiple" name="submitted_category[]" >
<option value="test">test</option>
<option value="tests">tests</option>
<option value="testing">testing</option>
</select>
But when I print_r the array it just prints it as "Array"
Here's the php
$submitted_category = $_POST['submitted_category'];
if(isset($submitted_category)){
print_r($submitted_category);
}
Upvotes: 0
Views: 356
Reputation: 960
print_r($submitted_category[0]);
You set your select to be an array of values, so you need to choose which Index you want to print out
Something like this as well may help you see all of the values if you are using more than one select
foreach($submitted_category as $value)
{
print_r($value);
}
Upvotes: 0
Reputation: 1015
Print the element you wish to return. Example:
print_r($submitted[1]); // print element at position 1
or:
print_r($submitted[0]); //index of array.
Try:
var_dump($submitted);
as well.
Upvotes: 1