I need create a table, in the column the size and in the row the quantity for every product, I create a query where put in array the different result to have column and row and after I create a table.. I need to update every time there anybody do a change
while($xx < count($testa))
{
$testaecho .= "<th>".$testa[$xx]."</th>";
$corpoecho .= "<td style=' max-width: 20px;'>";
$corpoecho .= "<form name='changeqta' method='post' action=''>";
$corpoecho .= "<input type='number' maxlength='3' id='mod' value='".$corpo[$xx]."'>";
$corpoecho .= "<input type='hidden' id='ctgr' value='".$idriga[$xx]."'>";
$corpoecho .= "</form>";
$corpoecho .= "</td>";
$xx++;
}
echo "<tr>".$testaecho."</tr>";
echo "<tr>".$corpoecho."</tr>";
and in the jquery
<script>
$(document).ready(function(){
$('#mod').on('change', function(){
var name=$("#mod").val();
var ctgr=$("#ctgr").val();
$.ajax({
url:'update.php',
method:'POST',
data:{
name:name,
ctgr:ctgr
},
success:function(response){
alert(response);
}
});
});
});
the problem is only the first input do the change, if i change all other input, the firs product or the other product not update... is the same that the second "mod" is not do the submit
why?