An error happened.

\n"; } } if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["edit"])) { if (isset($_POST["edit"])) foreach (get_users_products_array() as $product) { if ($product["public_id"] === $_POST["edit"]) { $edit_id = $_POST["edit"]; $edit_name = $product["name"]; $edit_description = $product["description"]; $edit_expiration = $product["expiration_date"]; $edit_cupboard = $product["cupboard_public_id"]; } } if ($edit_id === "") { $erreur = "

Unknown product.p>"; } $cupboard_list = ""; foreach (get_users_cupboards_array() as $row) { $cupboard_list = $cupboard_list . "\n"; } } if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["edit_completed"])) { if (isset($_POST["name"]) && isset($_POST["description"]) && isset($_POST["expiration"]) && isset($_POST["cupboard"])) { $cupboard_id = null; foreach (get_users_cupboards_array() as $cupboards) { if ($cupboards["public_id"] === $_POST["cupboard"]) $cupboard_id = $cupboards["id"]; } if (!update_product( $_POST["edit_completed"], $_POST["name"], $_POST["description"], empty(trim($_POST["expiration"])) ? null : $_POST["expiration"], $cupboard_id )) { $erreur = "

Something went wrong. Try again later.

"; } } else { $erreur = "

One of the edited section is missing.

"; } } $product_list = ""; foreach (get_users_products_array() as $row) { $product_list = $product_list . "" . htmlspecialchars($row["name"]) . "" . htmlspecialchars($row["description"]) . "" . htmlspecialchars($row["added_date"]) . "" . htmlspecialchars($row["expiration_date"] !== NULL ? $row["expiration_date"] : "-") . "" . htmlspecialchars($row["cupboard_name"] !== NULL ? $row["cupboard_name"] : "-") . "" . "
" . "" . "
" . "\n"; } ?> List products
Nom Description Ajouté le Expiration Rangement associé Editer Supprimer