一,insert.htm源码:
<html>
<head>
<meta http-equiv=”content-type” content=”text/html; charset=gb2312″>
<title>insert</title>
</head>
<body>
<p>score资料表–新增资料录
</p>
<p><hr noshade></p>
<form name=”form1″ method=”post” action=”insert.htm”>
<table width=”200″ border=”0″ align=”center”>
<tr>
<td>number</td>
<td><input type=”text” name=”number”></td>
</tr>
<tr>
<td>name</td>
<td><input type=”text” name=”name”></td>
</tr>
<tr>
<td>chinese</td>
<td><input type=”text” name=”chinese”></td>
</tr>
<tr>
<td>english</td>
<td><input type=”text” name=”english”></td>
</tr>
<tr>
<td>math</td>
<td><input type=”text” name=”math”></td>
</tr>
<tr>
<td><input type=”submit” name=”submit” value=”提交”></td>
<td> </td>
</tr>
</table>
</form>
<hr noshade>
</body>
</html>
二,insert.php源码:
<html>
<head>
<meta http-equiv=”content-type” content=”text/html; charset=gb2312″>
<title>insert</title>
</head>
<body>
<?php
mysql_connect(“ftp”,”root”,””);
mysql_select_db(“test”);
$sql=”insert into score (number,name,chinese,english,math) values ($number,$name,$chinese,$english,$math)”;
mysql_query($sql);
?> 新增一笔资料成功,<a href=”insert.htm”>请反回</a>!
</body>
</html>
所用到的sql语句:insert into score (number,name,chinese,english,math) values ($number,$name,$chinese,$english,$math)