I try to submit as many as I can by reading the data. But it keeps transmitting only the first data. How do I modify it? in this my code
<?php
$sql = "SELECT * FROM test";
$statement = $conn->prepare($sql);
$statement->execute();
$result = $statement->fetchAll();
foreach($result as $row)
{
?>
<input type="text" id="trdAmt" name="trdAmt" value="<?=$row["trdAmt"]?>" />
<script>
function doAction() {
var trdAmt=$("#trdAmt").val();
$.ajax({
url : '.test.php',
data : {
trdAmt : trdAmt,
},
dataType : 'json',
async: false,
type : 'POST',
dataType : 'json',
success : function(result) {
if(result.success == false) {
alert(result.msg);
return;
} alert(result.data);
}
});
}
</script>
<script type="text/javascript">
$(document).ready(function(){
$("#tmpBtn").trigger('click');
});
</script>
<?php
}
?>
in this html view
and in this consol.log view
How can i modify my code? I think maybe.. using array.. right??