I need help for this problem that i\'m trying to solve for a while (i\'m new in PHP). I have a form with several checkboxes which values are pulled from a database. I manage
This is the loop that I needed. I realized that I need a loop through each key with the $i
variable.
if(isset($_POST['id_dodatoci'])){
$id_dodatoci=$_POST['id_dodatoci'];
$arr_num=count($id_dodatoci);
$i=0;
while ($i < $arr_num)
{
$query="INSERT INTO `dodatoci_hotel`(id_dodatoci,info_id)
VALUES ('$id_dodatoci[$i]','$info_id')";
$res=mysql_query($query) or die('ERROR INSERTING: '.mysql_error());
$i++;
}
}