I have a form like this
<div class="form-group">
<label class="col-sm-3 control-label">
<?php echo get_phrase('account');?>
</label>
<div class="col-md-6">
<input type="text" name="account" class="form-control" width="200px">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">
<?php echo get_phrase('dr_to');?>
</label>
<div class="col-md-6">
<input type="text" name="drto" class="form-control" width="200px">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">
<?php echo get_phrase('item');?>
</label>
<div class="col-md-6">
<input type="text" name="item" class="form-control" width="200px">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">
<?php echo get_phrase('Source_of_fund');?>
</label>
<div class="col-md-6">
<input type="text" name="sof" class="form-control" width="200px">
</div>
</div>
And another form which contain arrays like this
<tbody class="detail">
<tr>
<td class="no">1</td>
<td><input type="text" class="form-control productname" name="productname[]"></td>
<td><input type="text" class="form-control quantity" name="quantity[]"></td>
<td><input type="text" class="form-control price" name="price[]"></td>
<td><input type="text" class="form-control discount" name="discount[]"></td>
<td><input type="text" class="form-control amount" name="amount[]"></td>
<td><a href="#" class="remove">Delete</td>
</tr>
<!-- rest of table -->
i tried to insert it into the database i do not see any errors but yet still the data does not get inserted into my database the database always shows up empty this the php code i am using to do the insert
if(isset($_POST['save'])) {
$data['numb'] = $_POST['numb'];
$data['account'] = $_POST['account'];
$data['drto'] = $_POST['drto'];
$data['item'] = $_POST['item'];
$data['sof'] = $_POST['sof'];
$this->db->insert('voucherinfo', $data);
$this->db->query('voucherinfo', $data);
$id = $this->db->insert_id();
for($i = 0; $i<count($_POST['productname']); $i++)
{
mysqli_query("INSERT INTO vouchers
SET orderid = '{$id}',
issue_date = '{$_POST['productname'][$i]}',
details = '{$_POST['quantity'][$i]}',
price = '{$_POST['price'][$i]}',
amount = '{$_POST['discount'][$i]}',
unit_total = '{$_POST['amount'][$i]}'");
}
}