Ответы пользователя по тегу Массивы
  • Как передать несколько значений input с AI?

    artemiy_karkusha
    @artemiy_karkusha
    Гость в этой жизни.
    Если вы задаете такое имя переменной:
    name="account[number][][1]
    Вы создаете массив с полем account в котором задаете ключ number. После [] создаете еще новый массив. А уже в этом новом массиве описываете ключ 1, 2, 3.
    [
        "account" => [
            "number" =>[
                   [
                       "1" => <значение>
                   ],
                   [
                       "2" => <значение>
                   ],
                   [
                       "3" => <значение>
                   ]
             ]
         ]
    ]


    Решение:
    <form action="index.php" method="post">
        <input type="text" name="account[surname][]">
        <input type="text" name="account[address][]">
        <input type="text" name="account[phone][]">
        ...
        <input type="number" name="account[number][13][1]">
        <input type="number" name="account[number][13][2]">
        <input type="number" name="account[number][13][3]">
        <button type="submit">Send</button>
    </form>
    Ответ написан