I apologize for posting on this topic as it seems to get a lot of attention, but I am just stumped. I've searched through all the similar posts in this forum and have been unable to adapt anything to work for my purposes.
I have an array from a multiple select form that I am getting through $POST. I need to insert that array into a mysql table with another piece of data that is constant. There will be multiple fund_id's (contained in the $POST["select"] array) and those will all be linked to the same $entry_id and entered into the mysql table on separate lines. Here is the code:
if (isset($_POST['submitted'])) {
$entry_id = 10;
$select = $_POST["select"];
$selectCount = count($select);
echo $selectCount;
for ($i=0; $i < $selectCount; $i++) {
$query = "INSERT INTO articlefundlink VALUES('$entry_id', '$select[$i]')";
$r = @mysqli_query($dbc, $query);
}
}
For this example, the entry_id will always be 10. I included the "echo $selectCount;" line to verify that the array was working correctly, which it is. For some reason, the insert function just doesn't work. Can someone please take a look at the code and see if they can pick up on anything? Thank you very much. I really appreciate it.