I need to get the children of an element

0

I need to get the value of the inputs with ID nome and sobrenome , but when I use $_POST , it will return only the first, and I need them all separately.

<form method="POST">
  <tr id = "0">
    <td>
      <input id="nome"/>
    </td>
    <td>
      <input id="sobrenome"/>
    </td>
  </tr>
  <tr id = "1">
    <td>
      <input id="nome"/>
    </td>
    <td>
      <input id="sobrenome"/>
    </td>
  </tr>
  <tr id = "2">
    <td>
      <input id="nome"/>
    </td>
    <td>
      <input id="sobrenome"/>
    </td>
  </tr>
  <input type="submit">
</form>
    
asked by anonymous 21.06.2017 / 00:22

1 answer

1

IDs are unique identifiers, they can not be duplicated.

Enter the "name" attribute in the input tag and set the value to "name []". It would look like this:

<input name="nome[]"/>

This would create an array with all the values filled in.

    
21.06.2017 / 02:37