I am not sure about how to pass an associative array using form (POST). Here is the code for creating the associative array:
$final_input[] = array(
"term" => "$term",
"position" => "$position",
"menu" => "Function",
"component" => "$store_name"
);
<form name = "myform" action="test.php" method="POST">
<input type="hidden" value= "<?php echo $final_input;?>" name ="final_input">
<input type="submit" value="Submit" name="submit">
</form>
File : test.php; where I am trying to print the element of the array. But getting error. Any suggestion? Thank you.
<html>
<head>
<html>
<head>
</head>
<body>
<?php
$final_input = $_POST['final_input'];
foreach ($final_input as $input)
{
foreach ($input as $key => $info)
{
print "$key: $info<br>";
}
}
?>
</body>
</html>