$count = $_POST["count"]; $max = $_POST["max"]; include_once "../model/Item.php"; $itemObj = new Item(); $classArr = $itemObj->getClasses(); $classes = array(); foreach ($classArr as $class => $value) { $classes[$class] = $_POST["txtClass" . $class]; } $items = array(); for ($i = 0; $i <= $max; $i++) { if (isset($_POST["txtItem" . $i])) { $items[] = array("iditem" => $_POST["hidItem" . $i], "price" => $_POST["hidNewPrice" . $i], "adjustment" => $_POST["txtAdj" . $i], "order" => $_POST["hidOrder" . $i]); } } $msg = $priceList->editPriceList($items, $classes); $msgSplit = explode("_", $msg); if ($msgSplit[0] == "true") { $msg = "Price list edited"; $id = $msgSplit[1]; $edit = "&edit=true"; } else { $msg = utf8_encode($msg); } header("Location: ../view/priceListAdd.php?msg={$msg}&idprice_list={$id}" . $edit); break; case "deletePriceList": $priceList = new PriceList(); $priceLists = array(); foreach ($_POST as $key => $value) { if (substr($key, 0, 3) == 'chk') {