Here is my PHP (which works if all checkboxes are ticked):
if (!empty($_POST["name"])) {
$name = $_POST['name'];
$addressline1 = $_POST['addressline1'];
$addressline2 = $_POST['addressline2'];
$addressline3 = $_POST['addressline3'];
$addressline4 = $_POST['addressline4'];
$postcode = $_POST['postcode'];
$gender = $_POST['gender'];
$age = $_POST['age'];
$country = $_POST['country'];
$product = $_POST['product'];
$colour = $_POST['colour'];
$size = $_POST['size'];
$purchased = $_POST['purchased'];
$comments = $_POST['comments'];
$hillwalking = $_POST['hillwalking'];
$climbing = $_POST['climbing'];
$mountaineering = $_POST['mountaineering'];
$trailrunning = $_POST['trailrunning'];
$roadrunning = $_POST['roadrunning'];
$mountainbiking = $_POST['mountainbike'];
$roadbiking = $_POST['roadbike'];
$adventurerac = $_POST['adventurerac'];
$others = $_POST['others'];
$sqlupdatequery = "INSERT INTO tblguarantees (name, addressline1, addressline2, addressline3, addressline4, postcode, gender,
age, countryid, productid, size, purchased, comments, colour, hillwalking, climbing, mountaineering, trailrunning,
roadrunning, mountainbiking, roadbiking, adventureracing, others)
VALUES ('$name', '$addressline1', '$addressline2', '$addressline3', '$addressline4', '$postcode', '$gender',
'$age', $country, $product, '$size', '$purchased', '$comments', '$colour', $hillwalking, $climbing, $mountaineering,
$trailrunning, $roadrunning, $mountainbiking, $roadbiking, $adventurerac, '$others')";
echo $sqlupdatequery;
$updateresult = mysql_query($sqlupdatequery);
}
Here is part of my Form which posts to itself:
<form name="register" id="register" method="post" action="register.php">
<table cellpadding="0" cellspacing="">
<tr>
<td class="reglabelcell">Sports Participation</td>
<td class="reginputcell"></td>
</tr>
<tr>
<td class="reglabelcell">Hillwalking</td>
<td class="reginputcell"><input name="hillwalking" type="checkbox" id="hillwalking" value="-1"></td>
</tr>
<tr>
<td class="reglabelcell">Climbing</td>
<td class="reginputcell"><input name="climbing" type="checkbox" id="climbing" value="-1"></td>
</tr>
<tr>
<td class="reglabelcell">Mountaineering</td>
<td class="reginputcell"><input name="mountaineering" type="checkbox" id="mountaineering" value="-1"></td>
</tr>
<tr>
<td class="reglabelcell">Trail Running</td>
<td class="reginputcell"><input name="trailrunning" type="checkbox" id="trailrunning" value="-1"></td>
</tr>
<tr>
<td class="reglabelcell">Road Running</td>
<td class="reginputcell"><input name="roadrunning" type="checkbox" id="roadrunning" value="-1"></td>
</tr>
<tr>
<td class="reglabelcell">Mountain Biking</td>
<td class="reginputcell"><input name="mountainbike" type="checkbox" id="roadrunning" value="-1"></td>
</tr>
<tr>
<td class="reglabelcell">Road Biking</td>
<td class="reginputcell"><input name="roadbike" type="checkbox" id="roadbike" value="-1"></td>
</tr>
<tr>
<td class="reglabelcell">Adventure Racing</td>
<td class="reginputcell"><input name="adventurerac" type="checkbox" id="adventurerac" value="-1"></td>
</tr>
<tr>
<td class="reglabelcell">Others</td>
<td class="reginputcell"><textarea class="othertextarea" id="others" name="others"></textarea></td>
</tr>
</table>
</form>
Many Thanks