Can anyone help me, just having a bit of a blank moment.
I currently have an array called industry, which holds a number of values.
I am submitting a form which has the industries displayed as a check box, however I want to keep the values selected when the form is submitted.
At the moment I am struggling to loop through the recordset and compare the results with those held in the array. Currently it loops through all the recordsets but only tries to match against 1 value hence I only get one industry selected.
while ($row = mysql_fetch_assoc($sql_result)){
foreach($industry as $key => $value){
if($row['id'] == $value){
echo '<td><input type=checkbox name=industry[] value="'.$row['id'].'" checked>'.$row['industry'].'</td>';
} else {
echo '<td><input type=checkbox name=industry[] value="'.$row['id'].'">'.$row['industry'].'</td>';
}
$i++; # increment counter
if ($i > $cols){ //create new row
echo '</tr><tr>';
$i = 1;
}
}
}