I'm getting array value from cart table and I want to insert cart array value into my order table but the problem I was facing is only last array value only inserting into my database but I want to insert all cart value into my order table.
/*This is the form page I was getting cart value*/
<form>
<input type="text" name="cid[]" value="1">
<input type="text" name="pid[]" value="2">
<input type="text" name="quantity[]" value="3">
<input type="text" name="total[]" value="5">
</form>
/*Once the form is submited the action comes to this php page*/
<?php
$cid = $_POST['cid'];
$pid = $_POST['pid'];
$quantity = $_POST['quantity'];
$total = $_POST['cid'];
$insertquery = "INSERT INTO orders(cid,pid,quantity,total) VALUES('$cid','$pid','$quantity','$total')";
?>
/*After excution of this code only inseting the last value, not inserting the all value */
MYSQLI_orPDOAPI's