hi, ive made 2 pages, which have the form.html page and check.php page. data from form page into check page into database but having problem.
FORM.HTML
<body>
<form id="form1" name="form1" method="post" action="check.php">
<input type="checkbox" name="subject[]" value="WD">Web Design <br />
<input type="checkbox" name="subject[]" value="PH">PHP <br />
<input type="submit" name="submit" value="submit">
</form>
</body>
CHECK.PHP
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("checkbox", $con);
//insert to the table
$sql="INSERT INTO test VALUES('','$_POST[subject[0]]','$_POST[subject[1]]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "CheckBox value succesfully added";
mysql_close($con)
?>
WHAT I WANT !! IS TO INSERT THE VALUES OF THE CHECKBOXES INTO DATABASE.