I am aware that there have been a lot of questions on $_POST ARRAY and MySQL, and I've been through a lot of them. However, none of the ones I have looked at do the trick for me.
I am trying to pass the row id's from a JQuery DataTable (using Gyrocode's ckeckboes plugin), form submit.
If I use:-
$i = 0;
foreach($_POST['id'] as $value){
echo "value : ".$value. '<br/>';
$i++;
}
I get output of
value: 1 value: 25 value: 32 value: 5 value: 17
Which is what I would expect (the amount of lines and the number values depend on how many checkboes I check).
But when I put the query in, it won't save to the database:-
$i = 0;
foreach($_POST['id'] as $value){
$sql = "INSERT INTO attendance (rider_id, at_date) VALUES ('$value', NOW())";
$i++;
}
I have tried all kinds of variations of this but nothing I do seems to work and it seems like a dumb mistake I'm making :)
Thanks