Help forming an array!!!

A

Anonymous

Guest
$temp_count = -1;
$array_max = 7;
while(++$temp_count < $array_max)
{
$output_array[$temp_count] = $temp_count+1;
}

if you plugged $array_max = 3 into that, you'd get

$output_array[0] = 1;
$output_array[1] = 2;
$output_array[2] = 3;

personally I wouldn't build an array though, I'd just echo the <option tags within the while loop

{
echo '<option value="' .$temp_count. '">Page ' .$temp_count. '</option>
';
}
and start $temp_count = 0 instead.
 
Back
Top