I need to change the post value on each iteration of foreach loop. Here is my code:
foreach ($amovess as $key => $val) {
$actions = $amovess[$key];
$lastid = $database->insert("tablename", [
"Action" => $actions,
"barcode"=>$data['barcode1txt'],
"barcode"=>$data['barcode2txt']
]);
}
I want that on first move of foreach loop $data['barcode1txt'] should insert and on second move $data['barcode2txt'] should insert. Please guide me.