$_POST Question
Posted: Sun Jul 05, 2009 11:13 am
Greetings:
I am a newbie to this forum. I am haing a problem accessing the individual elements in a form array. For example, below is a simple example:
The form contains the following
So I have the array material that is numerically indexed. Now when I do a phpinfo(0), the result shows:
Now, the problem I am having is I cannot access each inividual value in the material array. For example, here is my simplified code;
when I print $material within the loop, it is empty.
I then tried this:
Again, nothing???
Thanks in advance
I am a newbie to this forum. I am haing a problem accessing the individual elements in a form array. For example, below is a simple example:
The form contains the following
Code: Select all
<input type="text" name="material[0]" />
<input type="text" name="material[1]" />
<input type="text" name="material[2]" />
<input type="text" name="material[3]" />
Code: Select all
POST["material"] Array
(
[0] => 65
[1] => 8
[2] => 8
[3] => 15
)
Code: Select all
$i=0;
while ( $i < 4 ) {
$material=$_POST['material[$i]'];
$i++;
}
I then tried this:
Code: Select all
$i=0;
while ( $i < 4 ) {
$material=$_POST['materia'][$i]];
$i++;
}
Thanks in advance