Say i have the following form:
<form action="" method="post">
</BR>
<?php
// create two dropdowns with ajax
echo "<font id=\"categoria\"><select>
";
echo "<option value='0'>Select the Firm</option>
" ;
echo "</select></font>
";
?>
<?php
echo "<font id=\"subcategoria\"><select>
";
echo "<option value='0'>Select the Claims Hub</option>
" ;
echo "</select></font>
";
?>
<form method="post" align= "right">
<table >
<tr><td> </td>
<tr>
<td style="text-align: left; ">Criminal </td>
<td align="left" >
<input type="checkbox" name="mattertype" value="1" />
</td>
</tr>
<tr><td> </td>
<tr>
<td style="text-align: left; ">Labour </td>
<td align="left" >
<input type="checkbox" name="mattertype" value="1" />
</td>
</tr>
<tr><td> </td>
<tr>
<td style="text-align: left; ">Civil </td>
<td align="left" >
<input type="checkbox" name="mattertype" value="1" />
</td>
</tr>
<tr><td> </td>
<tr>
<td style="text-align: left; ">Active </td>
<td align="left" >
<input type="checkbox" name="active" value="1" />
</td>
</tr>
<tr><td> </td>
<tr>
<td> </td>
<td><input type="submit" name="submit" value="Add" align= "right" /></td>
</tr>
</table>
How would i write the php code to insert the following information as a new record for all the checked checkboxes? For example, i have checked Civil, Labour and Active. I now want the first record that must be inserted to read
Firm Area Mattertype Active (my sql table)
value of categoria value of subcategoria Civl 1
value of categoria value of subcategoria Labour 1
If any or all of the civil, labour or criminal checkboxes are ticked it must insert the value of categoria, value of subcatgoria, first ticked checkbox (mattertype) and if active is ticked then a 1 for active .
Then for the second record again value of categoria, value of subcatgoria, second ticked checkbox (mattertype) and if active is ticked then a 1 for active .
And so on. I hope this makes sense.