i am trying to pass an array in form using a hidden element in php. I first create the array then then are foreach which runs through each element in the loop, next I echo a html type with type hidden that will be in my form. Last I want to print out the hidden form element using print_r
Here is my code
<?php
$postvalue=array("a","b","c","e", "f", "g");
foreach($postvalue as $key => $value)
{
echo '<input type="hidden" name="result[]" value="'. $value. '">';
}
print_r($_POST['result']);
<?
When I run this code I get the following error from the print_r
Notice: Undefined index: result
How do I fix this?