留言板
来源:互联网 发布:lofter独立域名 编辑:程序博客网 时间:2024/04/28 06:16
数据库前台
<html>
<title>留言板</title>
<body>
<table border="0" align="center">
<form id="form1" method="POST" action="add.php">
<tr>
用户名:<input id="user" type="text">
</tr>
<tr>
</tr>
<tr></tr>
标题:<input id="title" type="text">
<textarea name="content" ></textarea>
</tr>
<tr><td><input type="submit" value="提交"></td>
<td><input type="reset" value="重置"/></td></tr>
</form>
</table>
</body>
</html>
连接数据库
<?php
//建立数据库连接
$conn=@mysql_connect("localhost","root","123") or die ("数据库链接错误");
//选择数据库
mysql_select_db("data");
//没置编码
mysql_query("set names gbk");
?>
实现功能
<?php
include 'content.php';//链接数据库
//$id=$_POST['id'];
$user=$_POST['user'];
$title=$_POST['title'];
$content=$_POST['content'];
//$lastdate=$_POST['lastdate'];
$sql="insert into news values(null,".$user.",'".$title."','".$content."')'";
$rs=mysql_query($sql);
?>
<script tyle="text/javascript" language="javascript">
function check(){
if(document.form1.user.value=="0"){
alert("请输入用户名及密码");
return false;
}
else if(document.form1.title.value==""){
alert("标题不能为空!");
return false;
}
return true;
}
</script>
- 留言板!
- 留言板
- 留言板
- 留言板
- 留言板
- 留言板
- 留言板
- 留言板
- 留言板
- 留言板
- 留言板
- 留言板
- 留言板
- 留言板
- 留言板
- 留言板
- 留言板
- 留言板
- 《大话处理器》序一与当当网预售地址
- 11GR1 RAC关于service/TAF的实验
- 新东方:俞敏洪从台前走入幕后
- 如何利用Qt Creator打包Meego程序
- 查找指定目录下的.exe文件 并且将.exe文件按全路径保存
- 留言板
- How to create a simple 2D graphics program?
- ac自动机+矩阵 poj 2778
- iphone ios4 视频捕捉
- Linux主要目录说明
- 关注C++细节——你能直接写出多少个C++关键字?
- Dsound声音播放
- 好朋友的爬虫共享资料,真佩服
- js定时刷新网页