Processing Form Combo Boxes with PHP

Hi there guys, below is a screenshot of what I have setup so far.

So as you can see each member has time checkboxes. I am unsure about how to progress from here. How to I change the database to mimic what has been selected for each staff member?

Code is
[php]


















5 6 7 8 9 10+
[/php]

This is in a loop so it creates it for each staff member. How would I assign this into a unique array to be processed and the database updated.

Cheers

I ended up getting this sorted out. Probably a round about way to do it but it works.
The Form with their name as the array.

<table width="170" align="center"> <tr> <td>5</td> <td>6</td> <td>7</td> <td>8</td> <td>9</td> <td>10+</td> </tr> <tr> <td><input name="'.$data[$i]['name'].'[]" type="checkbox" value="5" checked /></td> <td><input name="'.$data[$i]['name'].'[]" type="checkbox" value="6" checked /></td> <td><input name="'.$data[$i]['name'].'[]" type="checkbox" value="7" checked /></td> <td><input name="'.$data[$i]['name'].'[]" type="checkbox" value="8" checked /></td> <td><input name="'.$data[$i]['name'].'[]" type="checkbox" value="9" checked /></td> <td><input name="'.$data[$i]['name'].'[]" type="checkbox" value="10" checked /></td> </tr> </table>
[php]$numberOfStaff = $Script->getStaffNumbers();
while ($n <= $numberOfStaff){
$name = $Script->getStaffName($n);
if(is_array($_POST[$name])) foreach($_POST[$name] as $value){
$Script->setStaffHours($value, $name);
}
$n++;
}[/php]

First line get the total number of staff
Then between 1 and the total number of staff, create a loop to get each staff members name. Where there name is processed and returned as $name = $data[$n][‘name’]; from SQL
Then update the database for each staff member, for each checkbox value

Sponsor our Newsletter | Privacy Policy | Terms of Service