$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]); } } if (!$priceList->exists($_POST["txtName"])) { $msg = $priceList->addPriceList($items, $classes); $msgSplit = explode("_", $msg); if ($msgSplit[0] == "true") { $msg = "Price list added"; $id = $msgSplit[1]; $edit = "&edit=true"; } else { $msg = utf8_encode($msg); } } else { $msg = "The price list already exists, please choose another name"; } header("Location: ../view/priceListAdd.php?msg={$msg}&idprice_list={$id}" . $edit); break; case "editPriceList": $priceList = new PriceList();