mufen3351455
<form action="index.php" method="post"> <div class="most"> <div class="left"> 学号: <input class="a" type="text" name="学号" /> </br> 姓名: <input class="a" type="text" name="姓名" /> </br> 性别: <input class="a" type="text" name="性别" /> </br> 年级: <input class="a" type="text" name="年级" /> </br> 院系名称: <input type="text" name="院系名称" /> </br> </div> <div class="right"> 专业名称: <input type="text" name="专业名称" /> </br> 学制: <input class="a" type="text" name="学制" /> </br> 班级名称: <input type="text" name="班级名称" /> </br> 出生日期: <input type="text" name="出生日期" /> </br> 民族: <input class="a" type="text" name="民族" /> </br> </div> </div> <input class="b" type="submit" /></form><?php$con = mysql_connect("localhost","root","root");if (!$con){ die('Could not connect: ' . mysql_error()); //die后为不执行}//else//{// echo("right");//}mysql_select_db("school", $con);mysql_query("insert into student_2014(学号,姓名,性别,年级,院系名称,专业名称,学制,班级名称,出生日期,民族)VALUES('$_POST[学号]','$_POST[姓名]','$_POST[性别]','$_POST[年级]','$_POST[院系名称]','$_POST[专业名称]','$_POST[学制]','$_POST[班级名称]','$_POST[出生日期]','$_POST[民族]')");if (!mysql_query($sql,$con)){ die('Error: ' . mysql_error());}echo "1 record added";mysql_close($con)?>