Note: $i is set earlier in the code and there are 25 drop down boxes, the array shows the first 5 have values, so I need to set those drop downs to selected and show the relevant value.
I have an array that contains the following:
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => [19] => [20] => [21] => [22] => [23] => [24] => )
$i=1;
for ($p=1; $p<=25; $p++){
for ($pp=1; $pp<=5; $pp++){
echo "<select id='rqa".$i."".$p."' class='business' name='q".$i."[]' onclick='mand();'>
<option value='' selected='selected'>".$rank."</option>
<option value='".$pp."'";
if (in_array($p, $arr)) echo 'selected';
echo ">".$pp."</option>";
}
}
All I am trying to do is set set the relevant dropdown as selected and also its value. Make sense?
All this is doing is setting the first 5 dropdowns to selected but their value is 5, instead on 1,2,3,4,5.
The problem I have having