Form with multiple input with same name

Hi,

Is it possible to use the following structure and store input of same name into an array where input name is in the form of name=“data[]”?

    <form id="my-form" class="list form-store-data">
      <li>
         <input type="text" name="data[]">Data 1</input>
     </li>
     <li>
         <input type="text" name="data[]">Data 2</input>
     </li>
   </form>

Output: data[“Data 1”, “Data 2”]
At the moment, I have to write a separate javascript to manually create a name called data_manual_id for each input field which isn’t very efficient.

Any advice?