While I am using arrays, I don't always understand what is going on especially when it works. The following array, I am using a foreach but it only iterates once and only displays the last array item (div3):

		
$i=0;  		
foreach ($div_array as $this_div);  		
{  			
$_POST['divnamev'][$i]=$this_div['div_name'];$_POST['divgenderv'][$i]=$this_div['div_gender'];
$_POST['divagev'][$i]=$this_div['div_age'];
			$i++;
}  
[0] => Array
    (
        [0] => 1
        [div_id] => 1
        [1] => 4
        [league_id] => 4
        [2] => 1
        [sport_id] => 1
        [3] => DIV 1
        [div_name] => DIV 1
        [4] => B
        [div_gender] => B
        [5] => 8
        [div_age] => 8
    )

[1] => Array
    (
        [0] => 2
        [div_id] => 2
        [1] => 4
        [league_id] => 4
        [2] => 1
        [sport_id] => 1
        [3] => DIV 2
        [div_name] => DIV 2
        [4] => G
        [div_gender] => G
        [5] => 9
        [div_age] => 9
    )

[2] => Array
    (
        [0] => 3
        [div_id] => 3
        [1] => 4
        [league_id] => 4
        [2] => 1
        [sport_id] => 1
        [3] => DIV 3
        [div_name] => DIV 3
        [4] => C
        [div_gender] => C
        [5] => 10
        [div_age] => 10:confused:

    You need to increase your counter...

    $i++ inside your loop...

      sorry...in fact I do have the $i increment...just didn't copy/paste it into here...I apologize...

        Write a Reply...