I am sending an array through POST via a hidden input on a form. I am using JSON to populate the value of this hidden field with the array that I need to pass. On the form handler I then receive the array. However, when I try to count the number of items on the received array it says it is one. It seems that when I $_POST the received variable has the format of an array ["...","..."] but it not recognized as one. Can I cast it into an array? I used the explode() with the comma delimited but the exploded array maintains the '[' and ']' with the first and last elements of the array.
HTML: (here I am showing an example with the value field already populated)
<input type="hidden" name="uploadFilenames" id="uploadFilenames" value="["64034_397137903702241_1591760198_n.jpg","77089_399984063417625_1968141154_n.jpg"]">
PHP:
$filearray = $_POST['uploadFilenames'];
$numFiles = count($filearray);
for($i = 0; $i < $numFiles; $i++) {
echo $filearray[$i] . "<br />";
}