I have PHP
form. This foreach
is execute multiple checkedboxs
. I want know, User selected checked boxs C_ID
INSERT
to the database. This code not working properly.
<?php
if(isset($_POST['send'])){
foreach($_POST['mod'] as $checkbox){
$checkbox = $values[COURSE_ID];
echo $checkbox . ' ';
$date = date("Y-m-d");
$sql= "INSERT INTO REG ( C_ID, REGISTERED, DATE) "
. "VALUES ('".$values[C_ID]."', 'Y' ,'".$date. "')";
DBQuery($sql);
}
}
echo "<form name=send method=post >";
foreach($result1 as $value) {
$checked = in_array($value, $selected) ? 'checked="checked"' : '';
echo '<input type="checkbox" name="mod[]" value="' . $value[C_ID] .'" ' . $checked . '>'. $value[TITLE] .'</input><br>';
}
echo "<button type=submit id=send name=send>send</button>";
echo "</form>";
?>
Aucun commentaire:
Enregistrer un commentaire