I am creating dynamic textfields buy using following Jquery option
Jquery Code
<script>
$(function () {
$('input.more').on('click', function () {
var $table = $('#input_fields');
var $tr = $table.find('tr').eq(0).clone();
$tr.appendTo($table).find('input').val('');
});
});
</script>
and Inserting records to the table using following PHP
$post_count = count($_POST['product']);
$post1 = array();
$post2 = array();
$post1 = $_POST['product'];
$post2 = $_POST['quantity'];
for ($i = 0; $i <= $post_count; $i++) {
$sql[] = "INSERT INTO product (product,quanity) VALUES ('".$post1[$i]."','".$post2[$i]."')";
}
foreach ($sql as $query) {
mysqli_query($conn, $query);
}
?>
1)the stock Id is retrieving from a table.
I want to know when I enter product and quantity ,how can I keep the same Stock Id in dynamically created text fields and insert data in to the database