projectcostingfile table I have checked my sql query several times and make sure that the names are correct. Still not inserting.
if(isset($_POST['submit'])){//to run PHP script on submit
if(!empty($_POST['check_list'])){
// Loop to store and display values of individual checked checkbox.
foreach($_POST['check_list'] as $selected){
echo $selected."</br>";
$sqlinsert="INSERT INTO projectcostingfile (material) VALUES ('".$selected."')";
mysqli_query($conn, $sqlinsert);
}
}
}
The variable $selected is echoed correctly. There is no error when I run the code too. Any help will be appreciated!
Thanks for your help. The problem lies with my table structure like what some of you mentioned. I set the column fields to NOT NULL. Therefore inserting into only 1 column would not have any INSERT record shown in the database.