将数组值和其他值从表单的值插入到两个不同的mysql表中

I'am trying to insert data from a form into two different tables. Here's what I'am doing:-

<?php

$mysqli= new mysqli("localhost","root","","store_records");
if($mysqli->connect_error)
    die("Database connection failed ".$mysqli->connect_error);

$query = "insert into bill_details(date,invoice_no,balance) values('".$_POST['p_date']."','".$_POST['invoice_no']."','".$_POST['balance']."')";
if($mysqli->query($query))
{
    $cquery="";
    for ( $i=0;$i<$_POST['row_numbers'];$i++) 
    {
        $cquery .= "insert into bill_records(item_name,qty,pack,batch,expiry,mrp,rate,vat,discount,invoice_no) values('".$_POST['item_name'][$i]."','".$_POST['qty'][$i]."','".$_POST['pack'][$i]."','".$_POST['batch'][$i]."','".$_POST['expiry'][$i]."','".$_POST['mrp'][$i]."','".$_POST['rate'][$i]."','".$_POST['vat'][$i]."','".$_POST['discount'][$i]."','".$_POST['invoice_no']."');";
    }
    if($mysqli->multi_query($cquery))
        echo "Records Saved";
    else
        echo "Failed to save product records";
}
else
{
    echo "Failed To save Records";
}
?>

Now, data from the first query is getting stored into bill_details table. but the array values are not getting stored. I cant figure out what am I doing wrong with my code. I wanna know how can i solve this problem and use the invoice_no as reference key for both the tables.

Here are the structure of both the database tables..

bill_details table

bill_records table

Try this. Hope it works. :)

<?php

$mysqli= new mysqli("localhost","root","","store_records");
if($mysqli->connect_error)
die("Database connection failed ".$mysqli->connect_error);

$query = "insert into bill_details(date,invoice_no,balance) values('".$_POST['p_date']."','".$_POST['invoice_no']."','".$_POST['balance']."')";
if($mysqli->query($query))
{
    $cquery="";
    for ( $i=0;$i<$_POST['row_numbers'];$i++) 
    {
        $cquery .= "insert into bill_records(item_name,qty,pack,batch,expiry,mrp,rate,vat,discount,invoice no) values('".$_POST['item_name'][$i]."','".$_POST['qty'][$i]."','".$_POST['pack'][$i]."','".$_POST['batch'][$i]."','".$_POST['expiry'][$i]."','".$_POST['mrp'][$i]."','".$_POST['rate'][$i]."','".$_POST['vat'][$i]."','".$_POST['discount'][$i]."','".$_POST['invoice_no']."');";
        if(!($mysqli->query($cquery)))
            die("failed to save");
    }
}
else{
    echo "Failed To save Records";
}

?>