Multidimensional form input array.
| From: | Alexander Deruwe | Date: | Wed, 10 Oct 2001 17:23:34 +0000 |
| Subject: | Multidimensional form input array. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-70683@lists.php.net to get a copy of this message | ||
Hewwo everyone,
I'm having a problem with multidimensional form input arrays. Suppose there
is a form set up like this:
.. some hidden input fields ..
<input type="hidden" name="Array[FileName]" value=something dynamic>
..
.. then a loop (or section if you will, since I use smarty) ..
<input type="text" name="Array[data][dynamic index][data_field]"
value=something dynamic>
The 'dynamic index' is the smarty loop index variable, which counts up from 0.
(Now, besides from the fact that someone already pointed out to me that
$Array might not be a good choice for naming this thing, I haven't before
found any problems relating to that so I'm going to try and find another
solution first)
In my .php file I loop over the data as such:
for ($i = 0; $i < count($Array['data']); $i++)
{
// do stuff with data fields in $Array['data'][$i]
}
But all the data fields are, not there, not set I guess.
Is there any reason for this?
Alexander.