PHP项目:留言板开发(表单提交后的页面处理)

add.php

<?php
error_reporting(0);
include ("conn.php");
$id=$_POST['id'];
$user=$_POST['user'];
$title=$_POST['title'];
$content=$_POST['content'];
if ($_POST['submit']){
    
    
 $sql="insert into message(id,user,title,content,lastdate)values('','$user','$title','$content',now())";
 mysql_query($sql);
 echo "<script>alert('提交成功!返回首页。');location.href='add.html';</script>";
}
?>

在这里插入图片描述

Guess you like

Origin blog.csdn.net/qq_37805832/article/details/120609591