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.

I have the database field as id,subject .
after running down, it shows the error pasted below:-
Parse error: parse error, expecting `']'' in C:\wamp\www\checkboxes\check.php on line 11

Kindly make certain possible running code with errors mentioned .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.