From d3b5345f7993442ea07114de65870537bf2c97c0 Mon Sep 17 00:00:00 2001 From: Thomas Rubini <74205383+ThomasRubini@users.noreply.github.com> Date: Thu, 26 Jan 2023 18:52:43 +0100 Subject: [PATCH] fix keys sent to backend --- Views/recipe/edit.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Views/recipe/edit.php b/Views/recipe/edit.php index 8cb218d..f92d448 100644 --- a/Views/recipe/edit.php +++ b/Views/recipe/edit.php @@ -77,9 +77,9 @@ if ($O_recipe === null) { foreach($A_ingredients as $O_ingredient) { echo '
  • - + - +
  • '; $i++; } @@ -89,9 +89,9 @@ if ($O_recipe === null) { } else { echo '
  • - + - +
  • '; @@ -112,16 +112,17 @@ if ($O_recipe === null) { if (count($A_steps) === 0) { echo '
  • - +
  • '; $numberOfInstructions = 1; } else { + $i = 1; foreach($A_steps as $S_step) { echo '
  • - +
  • '; $i++; } @@ -157,7 +158,6 @@ buttonIngredientPlus.addEventListener('click', () => { if(nextArray[e].tagName == "LABEL") { nextArray[e].setAttribute("for", "recipeIngredient"+numberOfIngredients); } else { - nextArray[e].setAttribute("name", "recipeIngredient"+numberOfIngredients); nextArray[e].setAttribute("id", "recipeIngredient"+numberOfIngredients); nextArray[e].value = ""; } @@ -191,11 +191,10 @@ buttonInstructionPlus.addEventListener('click', () => { for(let e in nextArray) { console.log(nextArray[e]); if(nextArray[e].tagName == "LABEL") { - nextArray[e].setAttribute("for", "recipeIngredient"+numberOfInstructions); + nextArray[e].setAttribute("for", "recipeInstruction"+numberOfInstructions); nextArray[e].textContent = "Étape "+numberOfInstructions+"\u00A0:"; } else { - nextArray[e].setAttribute("name", "recipeIngredient"+numberOfInstructions); - nextArray[e].setAttribute("id", "recipeIngredient"+numberOfInstructions); + nextArray[e].setAttribute("id", "recipeInstruction"+numberOfInstructions); nextArray[e].value = ""; } next.appendChild(nextArray[e]);