在大家的帮助下,我知道怎么插入数据代码<html>
<body><?php
$submit=null;
if ( isset($_POST["submit"])){
$submit=$_POST['submit'];
}if ($submit) {
$first=$_POST['first'];
$last=$_POST['last'];
$address=$_POST['address'];
$position=$_POST['position'];
// 处理表格输入 $db = mysql_connect("localhost", "root","overmax"); mysql_select_db("mydb",$db); $sql = "INSERT INTO employees (first,last,address,position)
VALUES ('$first','$last','$address','$position')";
$result = mysql_query($sql); echo "Thank you! Information entered.\n";} else
{ // 显示表格内容 ?> <form method="post" action="<?php echo $PATH_INFO;?>">
名:<input type="Text" name="first"><br>
姓:<input type="Text" name="last"><br>
住址:<input type="Text" name="address"><br> 职位:<input type="Text" name="position"><br> <input type="Submit" name="submit" value="输入信息"> </form> <?php} // end if,if结束
?></body></html>
<body><?php
$submit=null;
if ( isset($_POST["submit"])){
$submit=$_POST['submit'];
}if ($submit) {
$first=$_POST['first'];
$last=$_POST['last'];
$address=$_POST['address'];
$position=$_POST['position'];
// 处理表格输入 $db = mysql_connect("localhost", "root","overmax"); mysql_select_db("mydb",$db); $sql = "INSERT INTO employees (first,last,address,position)
VALUES ('$first','$last','$address','$position')";
$result = mysql_query($sql); echo "Thank you! Information entered.\n";} else
{ // 显示表格内容 ?> <form method="post" action="<?php echo $PATH_INFO;?>">
名:<input type="Text" name="first"><br>
姓:<input type="Text" name="last"><br>
住址:<input type="Text" name="address"><br> 职位:<input type="Text" name="position"><br> <input type="Submit" name="submit" value="输入信息"> </form> <?php} // end if,if结束
?></body></html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货