时间:2021-07-01 10:21:17 帮助过:22人阅读
session_start();
echo $_SESSION['username'];
if($_POST && $_POST['submit']){
$username =$_POST["username"];
$email = $_POST["email"];
$title = $_POST["title"];
$content = $_POST["content"];
$createtime = date("Y-m-d H:i:s");
$link = mysql_connect("127.0.1.1","root","")or die("不能连接服务器!可能是数据库服务器没有开启,或用户名密码错误!".mysql_error());
mysql_query("use db_leave");
mysql_select_db("db_leave",$link);
mysql_query("set names'utf8'");
$sql = "insert into l_text(id,username,email,title,content,createtime) values('','$username','$email','$title','$content','$createtime')";
$result = mysql_query($sql);
$r = mysql_query("select * from l_text");
}
?>
姓名: | 邮箱: | 标题: | 留言时间: | ||||
留言内容: |