hello guys...plz help me out in this
here's the html page
<html>
<body>
<form name="form1" method="post" action="checkbox_rec.php">
<p>
<input type="checkbox" name="category[]" value="MBA">
MBA
</p>
<p>
<input type="checkbox" name="category[]" value="MCS">
MCS
</p>
<p>
<input type="checkbox" name="category[]" value="Engineering">
Engineering</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>
and here's thephp page
<html>
<body>
<?php
$db = mysql_connect("localhost","root","triadpass");
mysql_select_db("trainers_db",$db);
$category = $_POST['category'];
$insertquery = "INSERT INTO category (cat_ID, cat_name) VALUES";
for($i = 0; $i < sizeof($category); $i++){
$query .= " (null,'" . $category[$i] . "')";
if(($i + 1) < sizeof($category)){
$query .= ",";
}
}
else {
echo "<BR>You didn't check the checkbox.\n";
}
?>
</body>
</html>
where i m going wrong..plzzzzzzzzzzz help me with the code