<?php include_once '../include/headers.php'; include_once '../include/dbutils.php'; include_once '../include/main.php'; include_once 'domain/providers.php'; db_connect(); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $request_payload = file_get_contents('php://input'); //var_dump($request_payload); $json = json_decode($request_payload); if (isset($_GET['updateCode'])) { $value = updateProductCode($json); } else { if (isset($_GET['updatePrice'])) { $value = updateProductPrice($json); } else { if (isset($_GET['updateName'])) { $value = updateProviderName($json); } else { $value = saveNewProduct($json); } } } //return JSON array exit(json_encode($value)); }
{ echo " ".$id; } } echo "Change Discount to".$dis; echo "\");"; echo "</script>";*/ } if (!empty($_POST['newProductSubmit'])) { //handle everything for a new product submit $name = adjustVariable($_POST['newProductName']); $cat = adjustVariable($_POST['newProductCategory']); $ing = adjustVariable($_POST['newProductIngredients']); $eVal = adjustVariable($_POST['newProductEnergyValue']); $pric = adjustVariable($_POST['newProductPrice']); saveNewProduct($name, $eVal, $pric, $cat, $ing); /*//debug info echo "<script language=\"javascript\">"; echo "alert(\""; echo "erstelle neues Produkt mit Namen: ".$name; echo " in Kategorie: ".$cat; echo " mit folgenden Zutaten:".$ing; if($ing) { foreach($ing as $id) { echo " ".$id; } } echo " einem Energiewert von:".$eVal; echo " und einem Preis von:".$pric."€";