[eluser]vincej[/eluser]
Hi - I have a web form which produces arrays in the manner of $_POST variables. Example:
Code:
print_r ($_POST['name']);
// PRODUCES:
Array
(
[0] => 25 Piece Bag
[1] => Ribs Small Pack 5 Pieces
[2] => breasts
[3] => Whole Chicken: 6 - 8 lbs
[4] => Ribs Large pack 20 pieces
)
There are many of these for product price, product ID etc. etc.
I want to upload these to my DB, so I have the following model. It is talking to to the DB as I can see the primary key auto increment, but I am not getting any data in. I have checked the spellings and all is well. I have also tried using the simple INSERT with a string, rather than INSERT_BATCH with an array, and I get the same outcome.
I must be doing something wrong. If anyone can offer me advice I am very Grateful !
Model:
Code:
function confirmed_Order(){
$quantity = $_POST['quantity'];
$name = $_POST['name'];
$prodid = $_POST['prodid'];
$pricelb = $_POST['pricelb'];
foreach($name as $n) {
$data = array ('Prodname' => $name);
$this->db->insert_batch('confirmedorder', $data);
}
}
I have also tried :
Code:
function confirmed_Order(){
$quantity = $_POST['quantity'];
$name = $_POST['name'];
$prodid = $_POST['prodid'];
$pricelb = $_POST['pricelb'];
foreach($name as $n) {
$data = array ('Prodname' => $n);
$this->db->insert('confirmedorder', $data);
}
}