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>";
}
?>

在这里插入图片描述

posted @ 2021-10-04 23:19  贵哥的编程之路  阅读(60)  评论(0)    收藏  举报