<form action="" method="post">
<input type=text name=name[]><input type=text name=sex[]><br/>
<input type=text name=name[]><input type=text name=sex[]><br/>
<input type="Submit" value=" 提交" size="50"/>
</form>
然后php页面,
<?php
mysql_connect("localhost","root","password");
mysql_select_db("databasename");
mysql_query("set names 'utf8'");
$name=$_POST['name'];
$sex=$_POST['sex'];
foreach($name as $key=>$value){
mysql_query("insert into test(name,sex) values('$value','".$sex[$key]."')");
}
?>