>
</form>
<?php
} // end if,if结束
?>
</body>
</html>
程序现在运行正常,那我们现在就可以取到表格输入的内容,并把它们发送给数据库。
<html> www~phperz~com
<body>
<?php
if ($submit) {
// 处理表格输入
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db); www~phperz~com
$sql = "INSERT INTO employees (first,last,address,position) VALUES ('$first','$last','$address','$position')";
$result = mysql_query($sql);
echo "Thank you! Information entered.n";
} else{
// 显示表格内容 www.phperz.com
?>
<form method="post" action="<?php echo $PATH_INFO?>"> 名:<input type="Text" name="first"><br> 姓:<input type="Text"
|