diff -r 217ba4596c4d -r 3c680d1dea35 www/includes/db_inventory_yeasts.php --- a/www/includes/db_inventory_yeasts.php Mon Oct 14 23:13:40 2019 +0200 +++ b/www/includes/db_inventory_yeasts.php Wed Oct 16 21:05:03 2019 +0200 @@ -2,6 +2,7 @@ require($_SERVER['DOCUMENT_ROOT']."/config.php"); require($_SERVER['DOCUMENT_ROOT']."/version.php"); +require($_SERVER['DOCUMENT_ROOT']."/includes/constants.php"); #Connect to the database $connect = mysqli_connect(DBASE_HOST, DBASE_USER, DBASE_PASS, DBASE_NAME); @@ -10,6 +11,7 @@ } mysqli_set_charset($connect, "utf8" ); + // get data and store in a json array if (isset($_POST['insert']) || isset($_POST['update'])) { if (isset($_POST['insert'])) { @@ -20,8 +22,8 @@ } $sql .= "name='" . mysqli_real_escape_string($connect, $_POST['name']); - $sql .= "', type='" . $_POST['type']; - $sql .= "', form='" . $_POST['form']; + $sql .= "', type='" . array_search($_POST['type'], $yeasttype); + $sql .= "', form='" . array_search($_POST['form'], $yeastform); $sql .= "', laboratory='" . mysqli_real_escape_string($connect, $_POST['laboratory']); $sql .= "', product_id='" . mysqli_real_escape_string($connect, $_POST['product_id']); $sql .= "', min_temperature='" . $_POST['min_temperature']; @@ -90,8 +92,8 @@ $yeasts[] = array( 'record' => $row['record'], 'name' => $row['name'], - 'type' => $row['type'], - 'form' => $row['form'], + 'type' => $yeasttype[$row['type']], + 'form' => $yeastform[$row['form']], 'laboratory' => $row['laboratory'], 'product_id' => $row['product_id'], 'min_temperature' => $row['min_temperature'],