Originally Posted by claro
You cannot put an array into a form field.
That there, is invalid, even if you set the name="someArray" to name="someArray". Doing what I just did above would do this (effectively):
$someArray = Array('value1', 'value2', 'value3', 'value4');
<input type="next" name="someArray" value="<?=$someArray?>" />
So it would pick up the first value in the array, or it could pick up ARRAY() or it could pick up 0. Trying to put arrays into form fields isn't something I tend to do, so the actual result I'm not sure, but it will be something like one of those.
<input type="text" name="someArray" value="value1" />
if you wanted each item in the array to be entered into a field (say you had a list of fields):
$someArray = Array('value1', 'value2', 'value3');
for each($someArray as $item)
echo('<input type="text" name="someArray" value="' . $item . '" />);
That would create an array called someArray in the POST, but its not an array in the field, but an array of fields sharing the same name (hook). Even in that case, you arent putting an array into the field.
So in other words, the individual form fields (the inputs) are single values NOT arrays. So lets say you have 5 fields that are all accnum, the first having 1 in it, the second 2 through to the 5th having 5.
The POST ($_POST['accnum']) however is an array in those circumstances but an array of those 5 fields not one of those fields holding an array.
A single form field cannot be an array and cannot hold an array at all.
Thats valid and collected using $accnum = $_POST['accnum'];
$accnum = "100";
<input type="text" name="accnum" value="<?=$accnum?>" />