Hi I know that multiple checkbox values has been discussed earlier but I have't got any wiser starring at them.
This is how I want the database entries to look like:
id ... drillID ...kommentar
====================
1559...1...........NULL
-------------------------------
1559...2...........NULL
-------------------------------
1559...3...........NULL
With the code below I can print out both id and drillID on the screen but it will only insert the last checked box value along with the id to the DB table why? The "kommentar" column is for later use.
The echo:
==========
1559 1
1559 2
1559 3
The insert:
===========
1559 3 NULL
<?php
$id = $_POST["spelarID"];
?>
<?php //echo $spelarID ?>
<?php
// loopa igenom din array
foreach ($_POST['drillSelect'] as $value)
{
// skriv ut innehållet
echo $id; ?> <?php echo $value . "<br />";
}
?>
<?php
$insertSQL = sprintf("INSERT INTO exercise_spelare_ref (id, drillID) VALUES ('$id', '$value')") ;
mysql_select_db($database_connect, $connect);
$Result1 = mysql_query($insertSQL, $connect) or die(mysql_error());
?>