I need some advice in the following code.
var count = 1;
$(function(){
$('#addmore').click(function(){
count += 1;
$('ul').append("<li><input type='text' id='hd"+count+"' name='hd"+count+"' value='heading' onClick='this.select();'> <input type='text' id='amount"+count+"' name='amount"+count+"' value='amount' onClick='this.select();'></li>");
// return false;
});
});
what exact php code should i use to submit all the input into my test table of mysql.
<button id="addmore">+</button>
<form id="myForm" name="myForm" action="" method="post" onSubmit="return false;">
<ul>
<li><input type="text" id="hd1" name="hd1" value="heading" onClick="this.select();">
<input type="text" id="amount1" name="amount1" value="amount" onClick="this.select();"></li>
</ul>
<input type="submit" value="Submit" id="submit" name="submit">
</form>
<?php
if(isset($_POST['submit'])){
echo "h";
};
?>
keeping in mind that i've test table with two fields 'heading' and 'amount'.
if(isset($_POST['submit'])){
foreach($_POST['hd'] as $hds){
echo $hds;
mysqli_query($con,"INSERT INTO test (hdg) VALUES ($hds)");
};
};
and its not adding data into my table