php – How to pass data from table to an input with [] format-ThrowExceptions

Exception or error:

I need to autocomplete an Input with selected data from a table. The problem is that the input has [] array format, so I don’t know how to tell to jQuery what is the input that I need to be complete by the data of the table, because there its at least 3 inputs with the same name, and I need just only one specific input to be completed.

Some part of code: (Visually, there is 3 inputs with the same format, generated by jQuery with the same name but in Array, because then I have to pass by PHP to a MySQL table.)

<input type="text" name="name[]" class="form-control input ok">

Normally, I was passing the data by this:

  • A button in the table which pick the data of the register like:

    <button onclick="agregaform1('<?php echo $datos ?>')"></button>
        function agregaform2(datos){

But its not working on this case because there are more than one input with the same name.

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *