I had multi tag input the same name.I had insert into Mysql success. But it's reload page. I want insert into mysql , then it's without reload page. I know use Ajax for this. But i don't know must how i do. Who can help me?Thanks
HTML :
<form id="students" action="insert.php" method="post">
a :<input name="c1[]" type="text" />
b :<input name="c2[]" type="text" />
c :<input name="c3[]" type="text" />
</br>
a :<input name="c1[]" type="text" />
b :<input name="c2[]" type="text" />
c :<input name="c3[]" type="text" />
</br>
a :<input name="c1[]" type="text" />
b :<input name="c2[]" type="text" />
c :<input name="c3[]" type="text" />``
<input type="submit" value="submit" id="submitbutton" class="insert" />
</form>
<script>
$('#students').submit(function() {
$.post('insert.php', $('form#students').serialize())
});
</script>
and "insert.php"
$a1=$_POST['c1'];
$b1=$_POST['c2'];
$c1=$_POST['c3'];
$index=0;
foreach($a1 as $s){
$sql = "INSERT INTO test(col_a,col_b,col_c) VALUES('$s','".$b1[$index]."','".$c1[$index]."')";
mysql_query($sql);
$index++;
}