The input input key does not work
-
There is a form by which input values are input, which is a mass
<textarea class="description-area" name="field[stext]"></textarea> <textarea class="description-area" name="field[ftext]"></textarea>
♪ ♪ Odd.
But you can't get a mass of species.
["stext" => "Тест1", "ftext" => "Текст2", ...]
There's a mistake:
Undefined index: stext, Undefined index: ftext
Only the conclusion is that PHP incrementalizes the key itself:
name="field[]" ["0" => "Текст1", ...]
But it's necessary that there be a key to further operations.
HTML:
<form action="data.php" method="POST"> <textarea class="description-area" name="field[stext]"></textarea> <textarea class="description-area" name="field[ftext]"></textarea> <button class="save-btn" name="edit">Изменить</button> </form>
data.php:
if (isset($_POST["edit"])) { // внутри array должно быть так "stext" => "Текст1", "ftext" => "Текст2",а получается только так "0" => "Текст1" итд $column = array($_POST["field"]); }
-
It's a question of cooling, not about the code. You have to make print_r($_POST); on the uniforms, and you'll see that your data isn't in the $_POST['stext'] but_POST['field']['stext']