Good afternoon,
I'm trying to get a Form as an array, but I'm not able to handle this array correctly. I have 6 fields 3 ID fields and 3 text fields, I tried to do so but to no avail. But it runs 6 times the array, not 3 as it should be.
returns like this. --ID - 1 --- --name ------- ID - 2 --- --name ------- ID - 3 --- --name ------- ID ----- --name - wwe ----- ID ----- --name - qwwqe ----- ID ----- --name - wqeeqw ---
<label>ID</label> <input type="text" class="form-control form-control-sm" name="array[][id]" > <label>ID</label> <input type="text" class="form-control form-control-sm" name="array[][id]" > <label>ID</label> <input type="text" class="form-control form-control-sm" name="array[][id]" > <label>array</label> <input type="text" class="form-control form-control-sm" name="array[][nome]" > <input type="text" class="form-control form-control-sm" name="array[][nome]" > <input type="text" class="form-control form-control-sm" name="array[][nome]" > <button type="submit" class="btn btn-sm btn-default" name="salvar"> salvar </button> </form>
$ test = $ _POST ['array']; mysqli_select_db ($ conn, "test"); foreach ($ test as $ key1 = > $ value1) { echo "--ID -". $ value1 ['id']. "---"; echo "
"; echo "--name -". $ value1 ['name']. "---"; "$query = mysqli_query($conn, "UPDATE excluidos SET rev2_email = '$aux' WHERE rev1_nome = '".$value1['id']."';");
}