yesterday, I was designing a platform to enter products and their quantities using drop-down lists, but I had to generate them using a button, so I had to use javascript. It worked, but at the moment of sending the data by post only takes the last Select generated, then the code and the result.

```
    <form id="pedido" name="pedido" action="funciones/pedido.php" method="post" >

<table name="pedidos" class="table table-bordered table-hover" id="myTable">
                                 <thead>
                                    <tr>
                                        <th>Producto</th>
                                        <th>Cantidad</th>
                                    </tr>
                                </thead>

</table>
<br>

</form>
<center>
<button class="btn btn-sm btn-primary"  onclick="myCreateFunction()">Agregar Producto</button>
<button class="btn btn-sm btn-danger" onclick="myDeleteFunction()">Eliminar Producto</button>
<button class="btn btn-sm btn-success"  form="pedido" type="submit">Guardar</button></center>
<br>

```

and the Javascript 

```
<script>
function myCreateFunction() {
    var table = document.getElementById("myTable");
    var row = table.insertRow(1);
    var cell = row.insertCell(0);

    <? $sql="select * from productodist where  rut_dist='".$_GET['id']."';";
$resultado=mysql_query($sql);
$x=0;?>
    var element = document.createElement("select");
 <? while($datos=mysql_fetch_array($resultado)){
     $x++?>
    var option<? echo $x; ?> = document.createElement("option");
    option<? echo $x; ?> .innerHTML = "<? echo  $datos['Descripcion'] ?>";
    option<? echo $x; ?>.value = "<? echo  $datos['CodArticulo'] ?>";
    element.add(option<? echo $x; ?>, null);
    element.name = "producto<? echo $x; ?>";

    <?
 }
    ?>
    cell.appendChild(element);

    var cell2 = row.insertCell(1);
    var element2 = document.createElement("select");
    //element2.type = "select"

    <?  for ($y=1;$y<=100;$y++){
        ?>    var option<? echo $y; ?> = document.createElement("option");
    option<? echo $y; ?>.innerHTML = "<? echo $y; ?>";
    option<? echo $y; ?>.value = "<? echo $y; ?>";
    element2.add(option<? echo $y; ?>, null);
    element2.name = "cantidad<? echo $x; ?>";
    <?  }?>
    cell2.appendChild(element2);
}

function myDeleteFunction() {
    document.getElementById("myTable").deleteRow(1);
}
</script>

```

And then when I send it, the post array anwer me this.

```
Array ( [producto30] => 20008 [cantidad30] => 1 )

```

What I'm doing wrong? Thanks you in advance!